[prev in list] [next in list] [prev in thread] [next in thread]
List: gtk
Subject: Re: Does GTK leak memory
From: Holger Berndt <berndth () gmx ! de>
Date: 2010-06-02 13:58:39
Message-ID: 20100602155839.09c7d707 () mrm-140 ! e-technik ! uni-ulm ! de
[Download RAW message or body]
On Wed, 02 Jun 2010 14:41:39 +0100 Emmanuele Bassi wrote:
> you are, of course, free to start asking people to use atexit()
> handlers to free up one-off allocations, starting from the bottom of
> the stack (font-config, freetype, X11, glibc, Mesa, etc.) and moving
> up towards gtk+.
No, please, that'd be a very bad idea. Quoting the documentation on
g_atexit:
======= 8< =======
On POSIX systems, calling g_atexit() (or atexit()) in a dynamically
loaded module which is unloaded before the program terminates might
well cause a crash at program exit.
[...]
As can be seen from the above, for portability it's best to avoid
calling g_atexit() (or atexit()) except in the main executable of a
program.
======= 8< =======
Libraries calling atexit() is asking for trouble. I've been bitten by
that before, and it's not a pleasant experience.
If anything, the libraries would need explicit teardown functions to be
manually called by the respective users. Startup/teardown would probably
have to be reference counted (imagine a glib application with a GTK+
plugin; and GTK+ tearing down glib on plugin unload). I doubt it's
worth the hassle.
Holger
_______________________________________________
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic