Re: GTK+ is not Valgrind-friendly
- From: muppet <scott asofyet org>
- To: gtk-devel-list gnome org
- Subject: Re: GTK+ is not Valgrind-friendly
- Date: Thu, 29 Apr 2004 22:21:50 -0400
On Thursday, April 29, 2004, at 08:41 PM, Paul Pogonyshev wrote:
I find Valgrind to be very useful in detecting memory access errors
and leaks. However, GTK+ leaves lots of unfreed memory at process
termination, which makes Valgrind output for a GTK+ application way
less usable and clean. I have about 1 MB of unfreed memory in about
140--150 loss records after a typical run of my program.
in its defense, gtk+ (and glib) allocate quite a few structures which
don't make any sense unless they live for the life of the app. i
decided to take the easy way out -- here's the suppression file i
created for using valgrind on gtk2-perl.
http://asofyet.org/muppet/software/gtk2-perl/gtk.supp
A new global function is declared, say gtk_free_all_memory(). This
function is not required to be called and it's up to each programmer
to decide whether to invoke it upon program termination. It should be
guarded with some preprocessor symbol to avoid unnecessary
dependancies on new GTK+ versions. A program that is wanted to have
"cleaner" memory profile could then look like this:
well, a simple g_at_exit() would take care of that for all cases,
without having to introduce a new function to the public API.
--
Walk softly, and carry a BFG-9000.
-- unknown
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]