[fpc-devel] Heaptrc settings by environments

Michael Van Canneyt michael at freepascal.org
Tue Apr 22 09:12:14 CEST 2014



On Mon, 21 Apr 2014, Martin Frb wrote:

> http://www.freepascal.org/docs-html/rtl/heaptrc/environment.html
>
> I was comparing the keywords accepted in the environment with the list of 
> options that exist in the unit.
>
> The following can be set by env, but is not in the doc (based on 2.7.1)
>  HaltOnNotReleased : boolean = false;
>
>
> Could/Should the following be added to the environment?
>
> Not sure what it actually does, but the option is implemented...
>  { less checking }
>  quicktrace : boolean=true;
>
>  { add a small footprint at the end of memory blocks, this  can check for 
> memory overwrites at the end of a block }
>  add_tail : boolean = true;
>
>  { put crc in sig   this allows to test for writing into that part }
>  usecrc : boolean = true;
>
>  printleakedblock: boolean = false;
>  printfaultyblock: boolean = false;
>  maxprintedblocklength: integer = 128;
>
> -----------
> About:
>  tracesize = 8;
>
> This is currently used in type definition
> theap_mem_info = record
>    calls    : array [1..tracesize] of codepointer;
>
> So it can not be changed at runtime.
>
> Without any intend of immediate action, but curiosity for future potential 
> patches, would it be considered acceptable, if:
> - The array was moved to the end of record, and defined
>    calls    : array [1..8] of codepointer;

I would make this array[1..1] of codepointer.

> But (without range check) would allow arbitrary indexes
> - All memory alloc would replace "sizeof(theap_mem_info)" by 
> "sizeof(theap_mem_info)+(tracesize-8)*sizeof(codepointer)"  (can be pre 
> calculated)
> - checks where in place to ensure it is divide-able by 8 / minimum of 8
> - all resulting errors and problems (potentially a great many) would be 
> fixed.
>
> Allowing to make the value configurable.

I want this feature since a long time since the default is ridiculously small.
I didn't think of putting it at the end of the block, and this could indeed work.

Michael.



More information about the fpc-devel mailing list