Re: Memory Issue
- From: "Freddie Unpenstein" <fredderic excite com>
- To: liam holoweb net, preetijoshi79 gmail com
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Memory Issue
- Date: Fri, 15 Dec 2006 03:48:22 -0500 (EST)
On Thu 12/14, Liam R E Quin < liam holoweb net > wrote:
On Fri, 2006-15-12 at 09:28 +0530, Preeti Joshi wrote:
Does GTK have a bug that doesn't free the memory used by a window
(say dialog) even after it has been destroyed?
It's often simpler to keep dialogues around and hide/show them.
Also make sure you unref everything!
There's a GTK function which you can connect to windows (or other widgets) to automatically hide them instead
of destroying them, if you don't need one of those "Really Close This Window" messages.
You can also use weak references to watch the lifetime of objects. A simple helper function can attach a
weak reference to an object, set to report a text message when the object gets destroyed, or put the object
in a GSList and remove it again when the object dies. In the latter case, you can run over the list of
remaining objects when the main loop quits and list all the ones that are still around (which can be helpful
for finding memory leaks).
By taking the text message as allocated memory (g_strdup() or g_strdup_printf() ), you can attach it to the
object with g_object_set_data_full(), and have it automatically cleaned up).
Fredderic
_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]