[fpc-pascal] Heaptrc unit is awesome

Graeme Geldenhuys graemeg.lists at gmail.com
Fri Nov 30 15:07:18 CET 2007


I had a suspicion that fpGUI was leaking some memory.  After
activating Heaptrc I got a bit of a shocker. I needed to log the
output to file because it was *very* long.   [Yeah I know, nothing to
be proud of].

I had 522 memory leaks!!  [hiding in shame]   But after enabling
Heaptrc and 1 hour later, fpGUI is now totally memory leak free!  :-)

And the best of all - all these cool tools are included with FPC.
Great job guys!

Feature Request:

A minor Feature Request for Heaptrc.  Using the log=<filename> in the
environment variable works wonders.  I fortunately didn't know that it
doesn't clear the file on every run (I'm used to tiOPF log behaviour).
 So for the first 30 minutes I was constantly staring at the 522
memory leak count (first few lines of the log file) and couldn't
figure out why I ain't getting that value any lower!
After 30 minutes I was growing frustrated and by pure luck I looked at
the log file size between runs and noticed it was growing.  Heaptrc
keeps _appending_ to the log and I was staring at the result of my
first run (over and over).  :-)

A quick:   $ rm ./out.log;  ./test
fixed the issue. Removing the log before each run.  Damn, I wasted a
lot of time on that.

Could we add extra option in the environment variable setting that
clears the log file on each run?

  - Graeme -

fpGUI - a cross-platform Free Pascal GUI toolkit

More information about the fpc-pascal mailing list