[Lazarus] heaptrc - Is it even worth using?

Graeme Geldenhuys graemeg.lists at gmail.com
Mon Oct 5 17:30:12 CEST 2009


2009/10/5 Lee Jenkins <lee at datatrakpos.com>:
>
> 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.

hehehe .... Now I don't feel alone.  The heap trace is from bottom-up.
So when you read from top to bottom, the leak appear near the first
source-code line you see.

But it's not always that easy or clear cut. There are many false
positives! Sometimes you get 20 memory leaks. But that is simply
because a crash occured and proper code clean-up was not triggered.
Which is also bad by the way. Anyway, when you do find the actually
memory leak, it will probably remove all the others too. But that
proper code-cleanup is still an issue that needs to be fixed.

HINT  HINT  HINT  HINT  HINT  HINT  :
HINT  HINT  HINT  HINT  HINT  HINT  :
Develop you code from day one, line one with the heaptrc enabled. That
way, as soon as you introduce a memory leak, it will be detected. Now
at least you know what code you were working on before you compiled an
ran you application. This way you find those buggers much easier!  :-)


I have spent many hours fixing one or two hard to find memory leaks! I
don't program now without heaptrc enabled. I only disable it on final
compilation before the product is shipped.


-- 
Regards,
  - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/




More information about the Lazarus mailing list