Re: Memory profiler for PHP?
| From: | Jake Cobb | Date: | Wed, 30 May 2007 15:07:07 +0000 |
| Subject: | Re: Memory profiler for PHP? | ||
| References: | 1 2 3 4 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-7892@lists.php.net to get a copy of this message | ||
Hello,
Hmm, that is interesting. The objects I'm freeing with unset() are GdkPixbuf and PangoLayout objects. Both classes are direct subclass of GObject. GtkDialog is a subclass of GtkObject, which it inherits the destroy() method from. I notice that GtkObject also has a sink() function for decrementing the reference counter. Perhaps the differences we see are due to this distinction? Have you tried sink()ing the GtkDialog before attempting to free it? In my own application, I never destroy dialogs; I just hide them when not in use so I didn't think about the difference in GObject-only subclasses vs GObject/GtkObject subclasses.
I also wonder whether extending a Gtk class in PHP has an effect on the way memory is handled versus a "pure" Gtk class. I'd love to hear some background on this from one of the developers.
If I can find some time to build the profiler and write some test cases, I'll post back to the list with what I find.
-Jake Cobb
Pistiolis Konstantinos wrote:
... Gtk seems to clean itself up by simply calling unset(). In the main ...Hmm, I have a class extending a GtkDialog and I'm listening to the 'destroy' signal. However, this is not sent when I just unset my derived class and the dialog window remains. I have to call $mydlg->destroy() myself Even more, I've added a __destruct function to my class (which is called when I unset my derived object) but php fails if I try to call parent::__destruct() with the error "Fatal error: Call to undefined method GtkDialog::__destruct()" So the gtk resources (and propably reffering php resources) are not being freed just by unsetting. Now the real test: I create a dialog and after I call destroy() manually and then I unset the object. I do this repeatedly and memory usage keeps increasing. So neither destroy() frees the memory. There is propably some refference of some object which is not dying. How can I ensure that there are no child widgets somewhere in my hierarchy that are still refferenced ? Kostas --PHP-GTK General Mailing List (http://gtk.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php .