[Lazarus] heaptrc - Is it even worth using?

Luiz Americo Pereira Camara luizmed at oi.com.br
Mon Oct 5 19:13:33 CEST 2009


Lee Jenkins escreveu:
> Michael Van Canneyt wrote:
>>
>>
>> On Mon, 5 Oct 2009, Lee Jenkins wrote:
>>
>>>
>>> Does anyone else have any trouble reading heaptrc output?  The only 
>>> thing that I can see of use is that it tells me there /is/ a leak.  
>>> However, trying to figure out where it is according to heaptrc 
>>> output seems more difficult and time consuming that searching 
>>> through the code.
>>>
>>> I'm not criticizing per se, just frustrated that I've spend 40 mins 
>>> looking at a heaptrc output file with still no clue as to where the 
>>> leak may be.
>>>
>>> Heap dump by heaptrc unit
>>> 4669 memory blocks allocated : 1093920/1110888
>>> 4621 memory blocks freed     : 1092756/1109608
>>> 48 unfreed memory blocks : 1164
>>> True heap size : 360448 (112 used in System startup)
>>> True free heap : 355808
>>> Should be : 356368
>>> Call trace for block $030FFC70 size 45
>>>  $0040734F
>>>  $005E9916  TTIOIDGENERATORGUID__ASSIGNNEXTOID,  line 489 of 
>>> M:/lazarus/components/tiOPF2/Core/tiOIDGUID.pas
>>>  $005CFA38  TTIOBJECT__CREATENEW,  line 2036 of 
>>> M:/lazarus/components/tiOPF2/Core/tiObject.pas
>>>  $005CFAF5  TTIOBJECT__CREATENEW,  line 2042 of 
>>> M:/lazarus/components/tiOPF2/Core/tiObject.pas
>>>  $004237AF  TFLEXOBJECTMAPPING__REGISTERPROPERTY,  line 259 of 
>>> M:/lazarus/projects/flexserver/src/flex_persistence.pas
>>>  $00423293  TMAPPINGREADER__REGISTERMAPPINGS,  line 128 of 
>>> M:/lazarus/projects/flexserver/src/flex_mapping_reader.pas
>>>  $00422EBB  TMAPPINGREADER__LOADMAPPINGS,  line 66 of 
>>> M:/lazarus/projects/flexserver/src/flex_mapping_reader.pas
>>>  $00422C86  TFORM1__BUTTON1CLICK,  line 40 of main_form.pas
>>
>> What is not clear about this ?
>>
>> In line 489 of M:/lazarus/components/tiOPF2/Core/tiOIDGUID.pas
>> a memory block of 45 bytes is allocated and never freed.
>>
>> Michael.
>
> First, thanks for responding so quickly, Michael.  Secondly, my 
> apologies as I pasted the wrong output.  The above was easy enough to 
> find as I was not freeing an object list that held the offending objects.
>
> The output that I meant to paste is this:
>
> M:\lazarus\projects\flexserver\gui_test\flexserver.exe
> Heap dump by heaptrc unit
> 4669 memory blocks allocated : 1093938/1110912
> 4651 memory blocks freed     : 1093626/1110576
> 18 unfreed memory blocks : 312
> True heap size : 294912 (112 used in System startup)
> True free heap : 293264
> Should be : 293456
> Call trace for block $03579D08 size 16
>   $0040D45B
>   $00439AB7
>   $00422EBB  TMAPPINGREADER__LOADMAPPINGS,  line 66 of 
> M:/lazarus/projects/flexserver/src/flex_mapping_reader.pas
>   $00422C86  TFORM1__BUTTON1CLICK,  line 40 of main_form.pas
>   $004C0BB4  TCONTROL__CLICK,  line 2227 of ./include/control.inc
>   $0050352F  TBUTTONCONTROL__CLICK,  line 72 of 
> ./include/buttoncontrol.inc
>   $005039F5  TCUSTOMBUTTON__CLICK,  line 164 of ./include/buttons.inc
>   $00503F51  TBUTTON__CLICK,  line 331 of ./include/buttons.inc
> Call trace for block $03579EE8 size 16
>   $0040A692
>   $0054783A
>   $00546A31
>   $00422EBB  TMAPPINGREADER__LOADMAPPINGS,  line 66 of 
> M:/lazarus/projects/flexserver/src/flex_mapping_reader.pas
>   $00422C86  TFORM1__BUTTON1CLICK,  line 40 of main_form.pas
>   $004C0BB4  TCONTROL__CLICK,  line 2227 of ./include/control.inc
>   $0050352F  TBUTTONCONTROL__CLICK,  line 72 of 
> ./include/buttoncontrol.inc
>   $005039F5  TCUSTOMBUTTON__CLICK,  line 164 of ./include/buttons.inc
> Call trace for block $00157D08 size 20
>   $0040A692
>   $00546A31
>   $00422EBB  TMAPPINGREADER__LOADMAPPINGS,  line 66 of 
> M:/lazarus/projects/flexserver/src/flex_mapping_reader.pas
>   $00422C86  TFORM1__BUTTON1CLICK,  line 40 of main_form.pas
>   $004C0BB4  TCONTROL__CLICK,  line 2227 of ./include/control.inc
>   $0050352F  TBUTTONCONTROL__CLICK,  line 72 of 
> ./include/buttoncontrol.inc
>   $005039F5  TCUSTOMBUTTON__CLICK,  line 164 of ./include/buttons.inc
>   $00503F51  TBUTTON__CLICK,  line 331 of ./include/buttons.inc
> Call trace for block $03579DA8 size 16
>   $0040D45B
>   $00439AB7
>   $00422EBB  TMAPPINGREADER__LOADMAPPINGS,  line 66 of 
> M:/lazarus/projects/flexserver/src/flex_mapping_reader.pas
>   $00422C86  TFORM1__BUTTON1CLICK,  line 40 of main_form.pas
>   $004C0BB4  TCONTROL__CLICK,  line 2227 of ./include/control.inc
>   $0050352F  TBUTTONCONTROL__CLICK,  line 72 of 
> ./include/buttoncontrol.inc
>   $005039F5  TCUSTOMBUTTON__CLICK,  line 164 of ./include/buttons.inc
>   $00503F51  TBUTTON__CLICK,  line 331 of ./include/buttons.inc
> Call trace for block $03579D58 size 16
>   $0040A692
>   $0054783A
>   $00546A31
>   $00422EBB  TMAPPINGREADER__LOADMAPPINGS,  line 66 of 
> M:/lazarus/projects/flexserver/src/flex_mapping_reader.pas
>   $00422C86  TFORM1__BUTTON1CLICK,  line 40 of main_form.pas
>   $004C0BB4  TCONTROL__CLICK,  line 2227 of ./include/control.inc
>   $0050352F  TBUTTONCONTROL__CLICK,  line 72 of 
> ./include/buttoncontrol.inc
>   $005039F5  TCUSTOMBUTTON__CLICK,  line 164 of ./include/buttons.inc
> //.. etc, etc.
>
> As you can see, its the same thing, repeatedly and unfortunately, it 
> doesn't make any sense to me where the rest of execution is going.  I 
> am using TXMLDocument in the "LoadMappings" method which is the only 
> thing that I can think of (code below).
>
> Maybe its related to this?
> http://bugs.freepascal.org/view.php?id=13605
>
> The only thing is that I have updated my lazarus with a latter 
> snapshot but I guess it could be the same thing maybe.
>
> My version is 9.27 rev. 21413 so it looks doubtful that is the problem 
> but I cannot say for sure.
>
> procedure TMappingReader.RegisterMappings; 

It should not be LoadMappings method?

Luiz




More information about the Lazarus mailing list