Re: glib: alloca brain damages



Kenneth Albanowski wrote:
> 
> On Fri, 8 Jan 1999, Jeff Garzik wrote:
> 
> > Kenneth Albanowski wrote:
> > > I don't have rigourous knowledge of alloca on various platforms, but my
> > > gut feeling is that trusting any of its behaviour whatsoever is somewhat
> > > dangerous. [...]
> > 
> > If you can't trust it, replace it.  That's why AC_FUNC_ALLOCA exists.
> 
> True, but fake alloca is slightly less interesting then real alloca, as
> it's not a perfect emulation. More consistent by a long shot, I'll grant.

Thought about this a bit when I was putting in the alloca macros.

The 'sane' module includes a copy of a garbage-collecting alloca, where
you have to manually call alloca(0) every now and then.  I think this is
the standard alloca replacement people use (but haven't search yet for
others).

It is tough to tune, but calling alloca(0) for every Nth call to g_free
or g_malloc may be one way to relieve the app programmer of doing it.
Only broken platforms will have to do this, thankfully.

	Jeff





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