Carbon


NewPtr

Header: MacMemory.h Carbon status: Supported

Allocates a nonrelocatable block of memory of a specified size.

Ptr NewPtr (
    Size byteCount
);
byteCount

The requested size (in bytes) of the nonrelocatable block.

function result

A pointer to the new block. If NewPtr fails to allocate a block of the requested size, it returns NULL.

DISCUSSION

The NewPtr function attempts to reserve space as low in the heap zone as possible for the new block. If it is able to reserve the requested amount of space, NewPtr allocates the nonrelocatable block in the gap ReserveMem creates. Otherwise, NewPtr returns NULL and generates a memFullErr error.

Call the function MemError to get the result code. See “Result Codes”.

Because NewPtr allocates memory, you should not call it at interrupt time.

AVAILABILITY

Supported in Carbon. Available in CarbonLib 1.0 and later when InterfaceLib 7.1 or later is installed. Exported by CarbonLib 1.0 and later and by InterfaceLib 7.1 and later.


© 2000 Apple Computer, Inc. — (Last Updated 4/6/2000)