Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2011-12

How do you get a report of unfreed objects in Lazarus after a program runs?

10 messages · 6 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bart
to Frank Church
Frank Church wrote 5 lines
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.

Compiling with heaptrace enabled (-gh) will report unfreed memory. In Lazarus it is somewehre in porjectoptions -> linking AFAIK.

Bart

Reply by email

Marcos Douglas
to Frank Church: 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

Reply by email

Frank Church
to Marcos Douglas
Marcos Douglas wrote 13 lines
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.

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?

Show quoted text 8 lines
Marcos Douglas -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Frank Church ======================= http://devblog.brahmancreations.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20111213/0086ce72/attachment.html>

Reply by email

Marcos Douglas
to Frank Church

2011/12/13 Frank Church :

Show quoted text 17 lines
On 13 December 2011 17:10, Marcos Douglas wrote: > > 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. Can the output be logged to a file?

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

Reply by email

Michael Van Canneyt
to Frank Church: Can the output be logged to a file? I am running in both console mode and in the normal…
Frank Church wrote 17 lines
On 13 December 2011 17:10, Marcos Douglas wrote: 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. Can the output be logged to a file?

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.

Reply by email

Frank Church
to Michael Van Canneyt
Michael Van Canneyt wrote 39 lines
On Tue, 13 Dec 2011, Frank Church wrote: > > On 13 December 2011 17:10, Marcos Douglas wrote: > 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. > > > > Can the output be logged to a file? > 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<http://www.freepascal.org/docs-html/rtl/heaptrc/setheaptraceoutput.html> Michael.

Thanks

Show quoted text 6 lines
-- ______________________________**_________________ Lazarus mailing list .**freepascal.org http://lists.lazarus.**freepascal.org/mailman/**listinfo/lazarus<http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus>
Frank Church ======================= http://devblog.brahmancreations.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20111213/537ade4e/attachment.html>

Reply by email

Graeme Geldenhuys
to Frank Church: 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.

Regards, ? - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://fpgui.sourceforge.net

Reply by email

Vincent Snijders
to Frank Church: Thanks Frank Church ======================= http://devblog.brahmancreations.com…
Show quoted text 8 lines
> > 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

The logfile can be read with the leakview ide plugin, that you can find in the lazarus/components directory.

Vincent

Reply by email

Frank Church
to Frank Church: How do you get a report of unfreed objects in Lazarus? I hav read something about heaptrc…
Frank Church wrote 10 lines
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 -- Frank Church

How is the output interpreted?

======================= http://devblog.brahmancreations.com
Frank Church ======================= http://devblog.brahmancreations.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20111216/79d78211/attachment.html>

Reply by email