Appendix A: System Routines — Memory Management
857
TI
-
89 / TI
-
92 Plus Developer Guide
Not for Distribution
Beta Version January 26, 2001
HeapMoveHigh
Declaration:
HANDLE
HeapMoveHigh
(HANDLE
handle
)
Category(ies):
Memory Management
Description:
Try to reallocate a block of heap memory as high in memory as possible.
The block must not be locked. Use
HeapAllocHigh
if a block must be
allocated high in memory when it is first allocated.
HeapMoveHigh
moves
an existing block of memory to high memory. Blocks of memory that are
locked for long periods of time should be moved high in memory so that
they do not interfere as much with the rest of the system.
Inputs:
None
Outputs:
If successful,
handle
is returned. If the block cannot be moved then
H_NULL is returned (the block is still in the same place as before, so no
memory is lost).
Assumptions:
None
Side Effects:
Will cause heap compression.
Availability:
All versions of the TI
-
89 / TI
-
92 Plus.
TI
-
89 / TI
-
92 Plus
Differences:
None
See Also: HeapAlloc, HeapAllocThrow
Example:
HANDLE hBlock;
void *vPtr;
if (hBlock = HeapAllocThrow(1000)) {
/* . . . use hBlock . . . */
Now if we need to keep a locked version around, move it high in memory
and lock it.
*/
HeapMoveHigh( hBlock );
vPtr = HLock( hBlock ); /* LOCK and dereference block */
/* . . . vPtr can now be used even if the heap is compressed . . .*/
return( hBlock ); /* in this case, caller will free the block */
}