![]() |
HPurge |
||||
Header: | MacMemory.h | Carbon status: | Supported | |
Marks a relocatable block as purgeable.
void HPurge ( Handle h );
A handle to a relocatable block.
The HPurge function makes the relocatable block to which h is a handle purgeable. If the block is already purgeable, HPurge does nothing.
The Memory Manager might purge the block when it needs to purge the heap zone containing the block to satisfy a memory request. A direct call to the PurgeMem function or the MaxMem function would also purge blocks marked as purgeable.
Once you mark a relocatable block as purgeable, you should make sure that handles to the block are not empty before you access the block. If they are empty, you must reallocate space for the block and recopy the blocks data from another source, such as a resource file, before using the information in the block.
If the block to which h is a handle is locked, HPurge does not unlock the block but does mark it as purgeable. If you later call HUnlock on h, the block is subject to purging.
If the Memory Manager has purged a block, you can reallocate space for it by using the ReallocateHandle function.
You can immediately free the space taken by a handle without disposing of it by calling the function EmptyHandle. This function does not require that the block be purgeable.
Call the function MemError to get the result code. See
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.