Any object that is pushed onto the stack is dynamically allocated anyway. Apparently, _alloca( ) has the potential to put the program's stack in the overflow state. Consider using malloc( ), calloc( ), or new/new[]. In addition, _alloca( ) is considered to be quite buggy according to the experts on Stack Overflow.
Well, malloc( ) causes heavy fragmentation. Try reading this link: http://compilers.iecc.com/comparch/article/91-12-079 . This will give you some insight on _alloca( ).
There are a variety of problems, none insurmountable:
* It requires compiler support.
* Every routine that has |alloca()| requires both a frame pointer
and a stack pointer.
* The compiler has to get right things like
f (alloca(10), alloca(10));
The naive implementation does something like: allocate 10 bytes,
push the address, allocate 10 bytes, push the address. The correct
behavior is allocate 10, allocate 10, push, push.
Fixing these problems is a ``small matter of programming'', that
complicates several things, with the corresponding problem of more bugs.