[Main]
Name=HeapAlloc
Type=Function
Subtype=ROM Call
Header Files=alloc.h
Definition=HANDLE HeapAlloc (unsigned long Size);

[ROM Call]
Index=$90

[Description]
Allocates memory and returns a handle of allocated block.

[Explanation]
HeapAlloc allocates a block of heap memory of <I>Size</I> 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 <A HREF="$$LINK(H_NULL)">H_NULL</A> if there is not enough memory. The maximum
size of a single block is 65520 bytes, and the minimum size is 6 bytes. Use
<A HREF="$$LINK(HeapDeref)">HeapDeref</A> 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.

[References]
In=HeapAllocESTACK, HeapAllocHigh, HeapAllocThrow, HeapFree, HeapRealloc, bascmd.h/cmd_cubicreg, bascmd.h/cmd_expreg, bascmd.h/cmd_linreg, bascmd.h/cmd_lnreg, bascmd.h/cmd_logistic, bascmd.h/cmd_medmed, bascmd.h/cmd_newdata, bascmd.h/cmd_onevar, bascmd.h/cmd_powerreg, bascmd.h/cmd_quadreg, bascmd.h/cmd_quartreg, bascmd.h/cmd_stogdb, bascmd.h/cmd_twovar, dialogs.h/DialogNew, dialogs.h/DlgMessage, error.h/ERD_dialog, estack.h/display_statements, estack.h/Parse1DExpr, events.h/EV_defaultHandler, events.h/handleRclKey, events.h/handleVarLinkKey, graphing.h/gdb_recall, homescr.h/HomeExecute, link.h/LIO_Get, link.h/LIO_Receive, menus.h/MenuBegin, menus.h/MenuLoad, menus.h/MenuNew, menus.h/PopupBegin, menus.h/PopupClear, menus.h/PopupNew, stdio.h/fopen, textedit.h/TE_open, unknown.h/EV_quit, unknown.h/GT_SaveAs, unknown.h/LIO_SendIdList, unknown.h/OO_New, unknown.h/PlotDup, unknown.h/PlotInit, unknown.h/SP_Define, unknown.h/store_data_var, unknown.h/time_loop, vat.h/EM_moveSymFromExtMem, vat.h/EM_twinSymFromExtMem, vat.h/FolderAdd, vat.h/VarStore, wingraph.h/WinOpen, unknown.h/_ROM_CALL_40C, unknown.h/_ROM_CALL_424
Out=HeapCompress, HeapGetHandle, system.h/NeedStack
