HeapAlloc Function (ROM Call 0x90)

alloc.h

HANDLE HeapAlloc (unsigned long Size);

Allocates memory and returns a handle of allocated block.

HeapAlloc allocates a block of heap memory of Size bytes (all odd sizes are rounded up to be even) and returns its handle. Allocated blocks are kept in a singly-linked list of blocks. Returns H_NULL if there is not enough memory. The maximum size of a single block is 65520 bytes, and the minimum size is 6 bytes. Use HeapDeref to dereference the handle and get a pointer to the actual memory. Note that an unlocked pointer to the heap is valid only as long as heap compression (i.e. garbage collection) is not done. This routine may cause garbage collection.


Uses: HeapCompress, HeapGetHandle, NeedStack
Used by: HeapAllocESTACK, HeapAllocHigh, HeapAllocThrow, HeapFree, HeapRealloc, cmd_cubicreg, cmd_expreg, cmd_linreg, cmd_lnreg, cmd_logistic, cmd_medmed, cmd_newdata, cmd_onevar, cmd_powerreg, cmd_quadreg, cmd_quartreg, cmd_stogdb, cmd_twovar, DialogNew, DlgMessage, ERD_dialog, display_statements, Parse1DExpr, EV_defaultHandler, handleRclKey, handleVarLinkKey, gdb_recall, HomeExecute, LIO_Get, LIO_Receive, MenuBegin, MenuLoad, MenuNew, PopupBegin, PopupClear, PopupNew, fopen, TE_open, EV_quit, GT_SaveAs, LIO_SendIdList, OO_New, PlotDup, PlotInit, SP_Define, store_data_var, time_loop, EM_moveSymFromExtMem, EM_twinSymFromExtMem, FolderAdd, VarStore, WinOpen, ROM Call 0x40C, ROM Call 0x424