[gst-devel] We should use alloca(3).

David Schleef ds at schleef.org
Fri Apr 2 17:37:21 CEST 2004


On Mon, Mar 29, 2004 at 08:18:15PM +0200, Andy Wingo wrote:
> Hey folks,
> 
> I think we should promote the use of alloca(3).

Use of alloca() causes subtle bugs, one of them being that failed
allocations cause segfaults.  Since we don't have a lot of stack
space to begin with, and GStreamer tends to encourage deeply nested
stacks, it's always been discouraged to store anything unnecessary
on the stack.  Another problem is that alloca() tends to make stack
smashing a lot easier.  I think these are both problems we'd
like to avoid, especially since some day, GStreamer may be expected
to handle untrusted media files.

Also, GStreamer doesn't chase CPU cycles.  It's just not worth it
for code that is executed on the order of once per iteration.  If
it were ~1000 or ~1e6 times per iteration, I would care.



dave...





More information about the gstreamer-devel mailing list