![]() |
HLock |
||||
Header: | MacMemory.h | Carbon status: | Supported | |
Prevents a relocatable block from moving within its heap zone.
void HLock ( Handle h );
A handle to a relocatable block.
If you plan to dereference a handle and then allocate, move, or purge memory (or call a function that does so), then you should lock the handle before using the dereferenced handle.
If the block is already locked, HLock does nothing.
If you plan to lock a relocatable block for long periods of time, you can prevent fragmentation by ensuring that the block is as low as possible in the heap zone. To do this, see the description of the ReserveMem function.
If you plan to lock a relocatable block for short periods of time, you can prevent heap fragmentation by moving the block to the top of the heap zone before locking. For more information, see the description of the MoveHHi function.
Call the function MemError to get the result code. See
Supported in Carbon. Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.
© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)