Carbon


PurgeMem

Header: MacMemory.h Carbon status: Supported

Purges the current heap zone.

void PurgeMem (
    Size cbNeeded
);
cbNeeded

The size, in bytes, of the block for which PurgeMem should attempt to make room.

DISCUSSION

The Memory Manager purges the heap automatically when a memory request fails. However, you can use PurgeMem to purge the current heap zone manually.

The PurgeMem function sequentially purges blocks from the current heap zone until it either allocates a contiguous block of the specified size or purges the entire zone. If PurgeMem purges the entire zone without creating a contiguous block of the specified size, PurgeMem generates the result code memFullErr.

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

The PurgeMem function purges only relocatable, unlocked, purgeable blocks. The function does not actually attempt to allocate the memory.

To purge the entire heap zone, call PurgeMem(maxSize).

Because PurgeMem purges 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)