HAL Heap

Part I: Overview ›› The HAL ›› Memory ››
Parent Previous Next

The HAL Heap


The HAL Heap manager is an object instance that can be used to allocate/deallocate memory for Init and other non-UOS programs.  The UOS executive has its own memory management component that it uses for the Executive heap.  It is very basic and doesn't support anything more than allocating/deallocating areas of physical memory.


type THAL_Heap = object

                    public

                        function Getmem( Size : Integer ) : Pointer ;

                        function Free( P : Pointer ) : Integer ;

                        function Realloc( P : Pointer ; Size : Integer ) : Pointer ;

                end ;


This is an abstract class.  All methods use the stdcall calling convention.  Note that the class doesn't support allocations of more than 2 Gb.


Item

Description

Getmem

Allocate Size bytes of memory and return a pointer to the first byte,  Returns null if there wasn't enough contiguous memory available.

Free

Frees the memory allocated at address P.

Realloc

Reallocates the memory allocated at address P, to be Size bytes long.  The function attempts to reallocate in place, but if it cannot, it allocates a new buffer and copies the data.  The function returns the address of the resized buffer (whether or not it changed).