Re: RFC: glocal - automatically freeing memory when it goes out of scope



On Mon, 2011-11-21 at 00:00 -0800, Hub Figuière wrote:
> On 16/11/11 12:05 PM, Mikkel Kamstrup Erlandsen wrote:
> > So; what say you? If there is interest I'll gladly polish it up for
> > inclusion. There are also tonnes of other low hanging fruits like
> > freeing other ref counted types, closing of streams, etc.
> 
> How about a g_autorelease_pool() or something like that? (see
> NSAutoreleasPool in GNUStep / Cocoa)

Just throwing this out there randomly...

I would buy autorelease pools over GtkObject's 'floating ref'
concept any day of the week and twice on sunday.

Unfortunately GtkObject's floating reference concept has bled
so deep into GObject by now and I think we're stuck with it

(although the idea of reimplementing GInitiallyUnowned to
just create an autoreleased object from the constructor is...
really intriguing...)


> 
> For those who don't know, basically you would do a
> g_object_autorelease() on a (refcounted) object you want to unref in the
> short term but keep long enough to be ref elsewhere.
> The actual unref is performed when the outer main loop runs or when the
> autorelease pool is destroy.
> 
> (that's the pattern in GNUStep / Cocoa)
> 
> And it might even actually work with floating references and it does not
> need a specific C compiler extension or C++.
> 
> 
> Hub
> 
> PS: and if that whole thing has already been debated and rejected, just
> say so. I might have been under a rock at that time or something.
> _______________________________________________
> gtk-devel-list mailing list
> gtk-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-devel-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]