[EMAIL PROTECTED] wrote:

>
>
> >Isn't that what alloca() is for?   (Ignoring the simple fact that alloca()
> >is actually horribly broken since it never tells you if it's failed, just
> >lets you corrupt your stack when you ask for too much memory.)
>
>
> Nah, it doesn't corrupt your sstack, it just overflows into the guard page
> and then the libraries.  (So you won't corrupt the stack but other stuff)

what happens if you use too much memory this way is that the kernel will
kill the process in case you try to _use_ the memory that could not be granted 
but where you don't have a feedback before it fails this way.


> But for allocations of "small" sizes alloca() is not more dangerous than
> calling another function.

How do you decide what a small size is?

If you implement e.g. pattern matching macro expansion for a make program
using dynamic arrays or alloca(), you may get a noticable recursion on the stack
and it will be the sum of the "small pieces" that finally kills make...

Jörg

-- 
 EMail:[EMAIL PROTECTED] (home) Jörg Schilling D-13353 Berlin
       [EMAIL PROTECTED]                (uni)  
       [EMAIL PROTECTED]     (work) Blog: http://schily.blogspot.com/
 URL:  http://cdrecord.berlios.de/old/private/ ftp://ftp.berlios.de/pub/schily
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to