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

### 9.3 Constants, Types and variables

The FillExtraInfoType is a procedural type used in the SetExtraInfo (240) call.

     type
         FillExtraInfoType = procedure(p : pointer);

The following typed constants allow to fine-tune the standard dump of the memory usage by DumpHeap (240):

     const
       tracesize = 8;
       quicktrace : boolean = true;
       HaltOnError : boolean = true;
       keepreleased : boolean = false;
       add_tail : boolean = true;
       usecrc : boolean = true

Tracesize specifies how many levels of calls are displayed of the call stack during the memory dump. If you specify keepreleased:=True then half the TraceSize is reserved for the GetMem call stack, and the other half is reserved for the FreeMem call stack. For example, the default value of 8 will cause eight levels of call frames to be dumped for the getmem call if keepreleased is False. If KeepReleased is true, then 4 levels of call frames will be dumped for the GetMem call and 4 frames wil be dumped for the FreeMem call. If you want to change this value, you must recode the heaptrc unit.

Quicktrace determines whether the memory manager checks whether a block that is about to be released is allocated correctly. This is a rather time consuming search, and slows program execution significantly, so by default it is set to False.

If HaltOnError is set to True then an illegal call to FreeMem will cause the memory manager to execute a halt(1) instruction, causing a memory dump. By Default it is set to True.

If keepreleased is set to true, then a list of freed memory blocks is kept. This is useful if you suspect that the same memory block is released twice. However, this option is very memory intensive, so use it sparingly, and only when it’s really necessary.

If add_tail is True (the default) then a check is also performed on the memory location just behind the allocated memory.

If usecrc is True (the default) then a crc check is performed on locations before and after the allocated memory. This is useful to detect memory overwrites.

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