How do you get a report of unfreed objects in Lazarus?
I hav read something about heaptrc and valgrind, but don't know if the latter works on Windows.
/vfclistsGUY

Mailing lists / lazarus / 2011-12
10 messages · 6 people · –
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
How do you get a report of unfreed objects in Lazarus?
I hav read something about heaptrc and valgrind, but don't know if the latter works on Windows.
/vfclistsGUY
Compiling with heaptrace enabled (-gh) will report unfreed memory. In Lazarus it is somewehre in porjectoptions -> linking AFAIK.
Bart
How do you get a report of unfreed objects in Lazarus? I hav read something about heaptrc…
2011/12/13 Frank Church
How do you get a report of unfreed objects in Lazarus? I hav read something about heaptrc and valgrind, but don't know if the latter works on Windows.
Include heaptrc unit in your program (would be the first unit) or use IDE 'Project'>'Project Options'|'Compiler
Options'|'Linking'<Debugging><Use Heaptrc unit>.
After you close your program, a message will be displayed to you.
Marcos Douglas
Can the output be logged to a file?
I am running in both console mode and in the normal mode using forms, and when I exit the program a lot of text flies by.
I am running Lazarus 0.9.30 and I remember that in 0.9.31 a dialog is show when the program exits. Is that dialog present in 0.9.30 with or without the heap trace?
2011/12/13 Frank Church :
I don't know.
I am running in both console mode and in the normal mode using forms, and when I exit the program a lot of text flies by.
I think I did not understand right, but I will try to answer: Open a new console and call your program. When the program finish the console still there.
I am running Lazarus 0.9.30 and I remember that in 0.9.31 a dialog is show when the program exits. Is that dialog present in 0.9.30 with or without the heap trace?
I use 0.9.31 (trunk) and never use heaptrc before .31 so, I don't know (but is very simple, just test it!)
Marcos Douglas
Can the output be logged to a file? I am running in both console mode and in the normal…
Yes.
In your main file, call SetHeapTraceOutput in heaptrc:
procedure SetHeapTraceOutput(const name : string);This is a documented feature:
http://www.freepascal.org/docs-html/rtl/heaptrc/setheaptraceoutput.html
Michael.
Thanks
Can the output be logged to a file? I am running in both console mode and in the normal…
2011/12/13 Frank Church :
I am running in both console mode and in the normal mode using forms, and when I exit the program a lot of text flies by.
TIP
-----
I highly recommend that any body developing software use heaptrc (-gh compiler parameter) from the start of their project if possible. Fixing a memory leak a minute after you introduced it, is much easier than hunting down 200+ memory leaks months down the line.
I would even go as far as to say, the -gh option should be enabled by default in Lazarus IDE.
Thanks Frank Church ======================= http://devblog.brahmancreations.com…
The logfile can be read with the leakview ide plugin, that you can find in the lazarus/components directory.
Vincent
How do you get a report of unfreed objects in Lazarus? I hav read something about heaptrc…
How is the output interpreted?
======================= http://devblog.brahmancreations.com