The heap error permits developpers to install a heap error hook which is called each time an
allocation cannot be completed by the default heap manager. HeapError is a pointer that points to
a function with the following prototype:
function HeapFunc(size : longint): integer;
|
The size parameter indicates the size of the block which could not be allocated. Depending on the
success, the error handler routine should return a value which indicates what the default heap
manager should do thereafter (cf. table (8.9)).
| Table 8.9: | Heap error result |
|
| | Value returned | Memory manager action |
|
| | 0 | Generates a runtime error 203 |
| 1 | GetMem,ReallocMem and New returns nil |
| 2 | Try allocating the memory block once again |
|
| | |
|