[gst-devel] use of g_alloca

David Schleef ds at schleef.org
Sun Sep 11 12:03:24 CEST 2005

On Sun, Sep 11, 2005 at 04:24:54PM +0200, Stefan Kost wrote:
> what is the problem with using g_alloca() [1][2]?

Using alloca() tends to lead to stack overflows, as well as stack
smashing attacks in security related code.  Using the allocated
area tends to trash the cache as well, depending on CPU, so it
often isn't faster than malloc.  And given that very few people
actually understand how to use alloca, it seems silly from a code
quality perspective to allow people to use a function with minimal
benefits (if any) but lots of caveats.

Oh yeah, it's also non-portable, and the code that emulates alloca()
leaks like crazy.


David Schleef
Big Kitten LLC (http://www.bigkitten.com/) -- data acquisition on Linux

More information about the gstreamer-devel mailing list