[Lazarus] Is this a bug?

Wolf wv99999 at gmail.com
Fri Jun 16 11:43:38 CEST 2017


If I understand you correctly, because
1. command line parameters are internally treated as a null-terminated 
string (i.e. AnsiString), a call to ParamStr() implies a heap allocation 
and thus,
2. since ParamStr() is handled by the system unit, a call to halt will 
result in a memory leak because Heaptrc is not aware of this allocation.

If this is correct, then the conclusion has to be that Heaptrc cannot be 
trusted as a debugging tool because it is ill-informed about what the 
system unit is up to.

wolf (rather disillusioned)

On 16/06/17 20:47, Mattias Gaertner via Lazarus wrote:
> On Fri, 16 Jun 2017 20:36:54 +1200
> Wolf via Lazarus <lazarus at lists.lazarus-ide.org> wrote:
>
>> Now I am nicely confused: If halt does call finalization sections, isn't
>> then all heap space requested by the system unit supposed to be freed as
>> well?
> The system unit is special. It is loaded even before the heap manager
> is initialized. Heaptrc does not report memory of the system unit.
>
> Heaptrc reports allocations after its initialization, which is
> usually right after the system unit.
>
>
> Mattias



More information about the Lazarus mailing list