[next] [prev] [prev-tail] [tail] [up]

#### The heap grows

By default, HeapError points to the GrowHeap function, which tries to increase the heap.

The GrowHeap function issues a system call to try to increase the size of the memory available to your program. It first tries to increase memory in a 256Kb chunk if the size to allocate is less than 256Kb, or 1024K otherwise. If this fails, it tries to increase the heap by the amount you requested from the heap.

If the call to GrowHeap was successful, then the needed memory will be allocated.

If the call to GrowHeap fails, the value returned depends on the value of the ReturnNilIfGrowHeapFails global variable. This is summarized in table (8.10).

Table 8.10: | ReturnNilIfGrowHeapFails value
ReturnNilGrowHeapFails | Default memory
value | manager action
FALSE | (The default) Runtime error 203 generated
TRUE | GetMem, ReallocMem and New returns nil

ReturnNilIfGrowHeapFails can be set to change the behavior of the default memory manager error handler.

[next] [prev] [prev-tail] [front] [up]