![]() |
ReallocateHandle |
||||
Header: | MacMemory.h | Carbon status: | Supported | |
Allocates a new relocatable block of a specified size and sets a handles master pointer to point to the new block.
void ReallocateHandle ( Handle h, Size byteCount );
A handle to a relocatable block.
The desired new logical size (in bytes) of the relocatable block. The new block is unlocked and unpurgeable.
Usually you use ReallocateHandle to reallocate space for a block that you have emptied or the Memory Manager has purged. If the handle references an existing block, ReallocateHandle releases that block before creating a new one.
In case of an error, ReallocateHandle neither allocates a new block nor changes the master pointer to which handle h points.
If many handles reference a single purged, relocatable block, you need to call ReallocateHandle on just one of them.
To reallocate space for a resource that has been purged, you should call LoadResource, not ReallocateHandle.
Because ReallocateHandle releases any existing relocatable block referenced by the handle h before allocating a new one, it does not provide an efficient technique for resizing relocatable blocks. To do that, use the SetHandleSize function.
Call the function MemError to get the result code. See
Because ReallocateHandle might purge and allocate memory, you should not call it at interrupt time.
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.