Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Memory /
Chapter 2 - Memory Manager / Memory Manager Reference
Memory Manager Routines / Changing the Sizes of Relocatable and Nonrelocatable Blocks


SetHandleSize

You can use the SetHandleSize procedure to change the logical size of the relocatable block corresponding to a handle.

PROCEDURE SetHandleSize (h: Handle; newSize: Size);
h
A handle to a relocatable block.
newSize
The desired new logical size, in bytes, of the relocatable block.
DESCRIPTION
The SetHandleSize procedure attempts to change the logical size of the relocatable block whose handle is h. The new logical size is specified by newSize. SetHandleSize might need to move the relocatable block to obtain enough space for the resized block. Thus, for best results you should unlock a block before resizing it.

An attempt to increase the size of a locked block might fail, because of blocks above and below it that are either nonrelocatable or locked. You should be prepared for this possibility.

SPECIAL CONSIDERATIONS
Because SetHandleSize allocates memory, you should not call it at interrupt time.

ASSEMBLY-LANGUAGE INFORMATION
The registers on entry and exit for SetHandleSize are
Registers on entry
A0Handle to the relocatable block
D0Desired new size of relocatable block
Registers on exit
D0Result code

RESULT CODES
noErr0No error
memFullErr-108Not enough memory
nilHandleErr-109NIL master pointer
memWZErr-111Attempt to operate on a free block
SEE ALSO
Instead of using the SetHandleSize procedure to set the size of a handle to 0, you can use the EmptyHandle procedure, described on page 2-51.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
3 JUL 1996