[Lazarus] RE : RE : RE : RE : RE : Console App Development

Martin lazarus at mfriebe.de
Mon Aug 15 15:16:29 CEST 2011


On 15/08/2011 09:33, Ludo Brands wrote:
> So far I have been concentrating on the memory usage before and after 
> closing the 450 files. I'm now concentrating more on what increases 
> when unload/load the 450 files since that would really be the "bad" 
> memory.


So I did another test.

I added at the end of SynEdit. destroy:
   GetMemoryManager(m);
   debugln(['****************** ',m.GetFPCHeapStatus().CurrHeapUsed])

That would show any memory allocated by pascal code. (but not memory 
that qt or w32 keep for some reason (even though the reason might be 
missing release calls by the pascal code...))

The initial sizes are matching the measurements taken by 
process-explorer (w32)

  41870000   open lazarus, with about a dozen units - close one unit, to 
trigger the output
198591312  open  450 univint - close one unit, to trigger the output
  63014880  close all 450 univint  => ok so some meory was kept

193982864  open 450 univint - close one unit, to trigger the output => 
hey we are even lower than last tim
  62963664   close all 450 univint => no extra memory kept on 2nd run

194002192 open again
  63734976 close again
193996224 open
  63027440 close

So that means:
- there may be memory allocated by the widgetset; some of this may not 
be returned (and heaptrc would not report this as leak)
  IF some of this isn not returned, then this might be an issue in 
Lazarus/LCL, BUT it could also be an issue of the widgetset itself.

- A huge amount of memory is allocated by pascal code, via the memory 
manager.
- Most of it is returned correctly.
- A certain amount is allocated and kept => but it does not increase


Those tests were done using heaptrc





More information about the Lazarus mailing list