Re: RFC: glocal - automatically freeing memory when it goes out of scope
- From: Emmanuele Bassi <ebassi gmail com>
- To: Tristan Van Berkom <tristanvb openismus com>
- Cc: gtk-devel-list gnome org
- Subject: Re: RFC: glocal - automatically freeing memory when it goes out of scope
- Date: Tue, 22 Nov 2011 09:48:29 +0000
hi;
On 22 November 2011 09:44, Tristan Van Berkom <tristanvb openismus com> wrote:
> Similarly the GMainLoop, by virtue of being a loop,
> should also push a pool onto the autorelease pool stack
> and pop it while dispatching GSources (and this is where
> you get the extra 'unref on mainloop hit' detail).
it's not strictly necessary to have a default behaviour, though.
we could have two distinct functions:
/* schedules a idle source to release the resources when we re-enter
the main loop */
void
g_autorelease_pool_pop_in_idle (GAutoreleasePool*);
/* releases the resources immediately */
void
g_autorelease_pool_pop (GAutoreleasePool*);
following the pattern in GIO. for MT applications we could even
provide a function to release resources within a specific GMainContext
as well, to release the resources in a specific thread instead of the
default main context.
the obvious issue is: how does this interact with languages that do
have a GC, and how does the API work to avoid making the life of
developers for high-level languages apps and/or bindings a nightmare.
if libraries start using this object for their internal allocations,
for instance, or start relying on it when using their API.
ciao,
Emmanuele.
--
W: http://www.emmanuelebassi.name
B: http://blogs.gnome.org/ebassi/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]