ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> php-gtk-general
php-gtk-general
Re: [PHP-GTK] Freeing up memory when objects drop out of scope
by Andrei Zmievski other posts by this author
Aug 11 2006 1:22PM messages near this date
Re: [PHP-GTK] Freeing up memory when objects drop out of scope | Re: [PHP-GTK] Freeing up memory when objects drop out of scope
If you can reproduce this memory leak using a short script, I'll  
happily take a look at it.

-Andrei


On Aug 11, 2006, at 11:05 AM, Andrew Buczacki wrote:

>  Quoting Andrei Zmievski <andrei@[...].com>:
> 
> > Sorry for a delayed reply.
> 
> >
> > What kind of object is this "screen"? GtkWindow?
> >
> >
> > Yes, and this is by design (for some objects). Most of the objects
> > like GtkButton, etc will be auto-destructed once they drop out of
> > scope. However, there is a handful (like GtkWindow, and others which
> > I can't remember now) that behave differently. These objects may have
> > internal references held to them from parts of Gtk+. So when a
> > GtkWindow drops out of scope, we check whether the refcount > 1 and
> > if so, we make the internal GtkWindow object "own", that is, hold a
> > reference to its wrapper. Then, if the refcount on the wrapper or the
> > internal object is decreased further, everything is cleaned up.
> >
> > Basically, you shouldn't really worry about memory management in PHP-
> > GTK aside from being aware of this issue.
> >
> >
> >
> > Did you try $this->screenvar->destroy()?
> >
> > -Andrei
> >
> 
>  I've since done a complete overhaul of the code, and now our memory  
>  issues are
>  supressed, if not gone completely.  In my example, the screen was a  
>  GtkHBox
>  which was swapped in and out of a single window.  There was a  
>  manager class that
>  would destroy the current screen (box) and create the next one in  
>  the sequence.
>  Since our memory requirements were rather low and based on the  
>  design of the
>  program we can't front-load all the content.
> 
>  Now, however, I've reduced each screen to its own PHP application.   
>  There's
>  still a manager, but it makes php calls instead of swapping.
> 
>  Using the destroy() method didn't seem to free up any more memory  
>  than the other
>  methods I tried.
> 
>  Sorry if this seems vague, but I don't really remember the old  
>  code, since this
>  new stuff is radically different.
> 
>  Andrew
> 
>  -- 
>  PHP-GTK General Mailing List (http://gtk.php.net/)
>  To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP-GTK General Mailing List (http://gtk.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Thread:
Andrew Buczacki
Andrei Zmievski
Andrew Buczacki
Andrei Zmievski
Christian Weiske
Andrew Buczacki
Christian Weiske

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved