SetPtrSize
SetPtrSize Shrink or expand a nonrelocatable memory block
#include <Memory.h> Memory Manager
void SetPtrSize(thePtr, newSize );
Ptr thePtr ; address of a nonrelocatable memory block
Size newSize ; desired size (a 32-bit value)
SetPtrSize expands or shrinks the size of a nonrelocatable memory block.
thePtr is the address of a nonrelocatable memory block; i.e., the value
obtained from a prior call to NewPtr.
newSize is the desired size of the block. It should be less than 16M (a
24-bit value).
Returns: none; the MemError function may return an Error Code of:
noErr (0) No error
memFullErr (-108) No room in heap
memWZErr (-111) Illegal operation on a free block

Notes: Requests to shrink a block will always succeed, but may eventually lead to
heap fragmentation.
A request to grow a nonrelocatable block will frequently fail. If any new
nonrelocatable block is allocated after thePtr, it will probably be directly
above the storage for thePtr, and therefore, thePtr's data area cannot be
expanded. Always test for an error via MemError, e.g.:
Ptr myPtr;
myPtr = NewPtr( 1000 );
.
:
SetPtrSize( myPtr, 2000 );
if ( MemError() ) {
. . . the call failed . . .
}