Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2014-04

Heaptrc settings by environments

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Martin Frb

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 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;
  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.

Reply by email

Michael Van Canneyt
to Martin Frb
Martin Frb wrote 40 lines
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.

Show quoted text 9 lines
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.

Reply by email

Martin Frb
to Michael Van Canneyt
Michael Van Canneyt wrote 16 lines
On Mon, 21 Apr 2014, Martin Frb wrote: > 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.

Was my first thought.

Then I reflected that the record should be dividable by 8 bytes. Though I overdone it, 1..2 (for 32 bit) would do that.)
Of course not really needed either, since the memory boundary will anyway be adjusted when the variable length is added.

Show quoted text 15 lines
> 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.

:)

Reply by email