Important: The information in this document is obsolete and should not be used for new development.
MemError
To find out whether your application's last direct call to a Memory Manager routine executed successfully, use theMemError
function.
FUNCTION MemError: OSErr;DESCRIPTION
TheMemError
function returns the result code produced by the last Memory Manager routine your application called directly.This function is useful during application debugging. You might also use the function as one part of a memory-management scheme to identify instances in which the Memory Manager rejects overly large memory requests by returning the error code
memFullErr
.
- WARNING
- Do not rely on the
MemError
function as the only component of a memory-management scheme. For example, suppose you callNewHandle
orNewPtr
and receive the result codenoErr
, indicating that the Memory Manager was able to allocate sufficient memory. In this case, you have no guarantee that the allocation did not deplete your application's memory reserves to levels so low that simple operations might cause your application to crash. Instead of relying onMemError
, check before making a memory request that there is enough memory both to fulfill the request and to support essential operations.ASSEMBLY-LANGUAGE INFORMATION
Because most Memory Manager routines return a result code in register D0, you do not ordinarily need to call theMemError
function if you program in assembly language. See the description of an individual routine to find out whether it returns a result code in register D0. If not, you can examine the global variableMemErr
. WhenMemError
returns, register D0 contains the result code.
Registers on exit D0 Result code RESULT CODES