Important: The information in this document is obsolete and should not be used for new development.
ReallocateHandle
To recover space for a relocatable block that you have emptied or the Memory Manager has purged, use theReallocateHandleprocedure.
PROCEDURE ReallocateHandle (h: Handle; logicalSize: Size);
h- A handle to a relocatable block.
logicalSize- The desired new logical size (in bytes) of the relocatable block.
DESCRIPTION
TheReallocateHandleprocedure allocates a new relocatable block with a logical size oflogicalSizebytes. It updates the handlehby setting its master pointer to point to the new block. The new block is unlocked and unpurgeable.Usually you use
ReallocateHandleto reallocate space for a block that you have emptied or the Memory Manager has purged. If the handle references an existing block,ReallocateHandlereleases that block before creating a new one.
If many handles reference a single purged, relocatable block, you need to call
- Note
- To reallocate space for a resource that has been purged, you should call
LoadResource, notReallocateHandle.![]()
ReallocateHandleon just one of them.In case of an error,
ReallocateHandleneither allocates a new block nor changes the master pointer to which handlehpoints.SPECIAL CONSIDERATIONS
BecauseReallocateHandlemight purge and allocate memory, you should not call it at interrupt time.ASSEMBLY-LANGUAGE INFORMATION
The registers on entry and exit forReallocateHandleare
Registers on entry A0 Handle for new relocatable block D0 Desired logical size, in bytes, of new block
Registers on exit D0 Result code RESULT CODES
noErr 0 No error memROZErr -99 Heap zone is read-only memFullErr -108 Not enough memory memWZErr -111 Attempt to operate on a free block memPurErr -112 Attempt to purge a locked block