Re: Varargs type stringification (#50972)



On Sun, Apr 01, 2001 at 04:15:41PM -0400, Owen Taylor wrote:
...
> > a good while back i already spent a couple thoughts on getting around
> > the need to free certain temporary values (mostly strings) and how to
> > provide a suitable g_alloca() implementation for systems where we can't
> > use native alloca() for whatever reasons.
> 
> Returning result allocated through alloca() is something that you
> _really_ should not do. It's not safe at all.
> 
> So, I don't see any way (without statement expressions, and not really
> even then) of writing something that works inline using alloca. And
> once you've given up the ability to write things inline, I think
> explicit deallocation is best.

  Although "inline"-ing of functions really may not be reliable, we can wrap it
in #define macro, it should be crossplatform safe.


> > i think the best approach for both is a stack-level dependant allocator
> > that's undergoing frequent release cycles triggered by the main loop.
> 
> Sounds scary.
> 
> And actually, I don't think using main-loop triggered deallocation is
> really safe, since people may write apps that do arbitrary amounts of
> operations before returning to the main loop.

  At least g_main_pending() has to be run from time to time in valid GTK+
applications. Application not responding for GTK+ input for long time is broken
anyway so some excessive memory usage is a minor problem for it.


							Lace




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