EasyManuals Logo
Home>Texas Instruments>Calculator>TI-89

Texas Instruments TI-89 Developer's Guide

Texas Instruments TI-89
1398 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #887 background imageLoading...
Page #887 background image
Appendix A: System Routines — Memory Management
845
TI
-
89 / TI
-
92 Plus Developer Guide
Not for Distribution
Beta Version January 26, 2001
HeapAlloc
Declaration:
HANDLE
HeapAlloc
(DWORD
Hlen
)
Category(ies):
Memory Management
Description:
Allocate a block of heap memory of the given size and return its handle.
Use
HeapDeref
to dereference the handle and get a pointer to the actual
memory. Note that a pointer to the heap is valid only as long as heap
compression is not done.
Inputs:
Hlen
Length of block of memory to allocate (all odd sizes are rounded
up to be even).
Outputs:
HANDLE of memory block allocated, H_NULL if not enough memory.
Assumptions:
Hlen
may not exceed 65520 bytes and the minimum block size is eight
bytes.
Side Effects:
May cause heap compression.
Availability:
All versions of the TI
-
89 / TI
-
92 Plus.
TI
-
89 / TI
-
92 Plus
Differences:
None
See Also: HeapAllocThrow, HeapDeref, HeapFree, HeapLock, HeapRealloc,
HeapUnlock
Example:
BYTE *bPtr1, *bPtr2, *bPtr3;
HANDLE hBlock1, hBlock2, hBlock3;
if (hBlock1 = HeapAlloc(1000)) {
bPtr1 = HeapDeref( hBlock1 );
/* use bPtr1 */
if (hBlock2 = HeapAlloc(500)) {
bPtr1 = HeapDeref( hBlock1 ); /* hBlock1 may have moved because of HeapAlloc */
bPtr2 = HeapDeref( hBlock2 );
/* can now user bPtr1 and bPtr2 */
HeapLock( hBlock1 ); /* hBlock1 will NOT move */
if (hBlock3 = HeapAlloc( 750 )) {
bPtr2 = HeapDeref( hBlock2 ); /* hBlock2 may have moved, hBlock1 will not */
bPtr3 = HeapDeref( hBlock3 );
/* can now user bPtr1, bPtr2, and bPtr3 */
HeapFree( hBlock3 );
}
HeapFree( hBlock2 );
}
HeapFree( hBlock1 );
}

Table of Contents

Other manuals for Texas Instruments TI-89

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Texas Instruments TI-89 and is the answer not in the manual?

Texas Instruments TI-89 Specifications

General IconGeneral
Display size (HxV)100 x 160 mm
Memory type639K FLASH ROM, 188K bytes RAM
Compatible operating systemsOperating System 2.09
Battery typeAAA

Related product manuals