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

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)

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++.


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.

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