The use of alloca vs. malloc must be evaluated on a case-by-case basis. There are many things to consider when looking at using alloca or malloc.
* Is this a hot path with a small allocation? If it is then it is very likely a good candidate for using alloca, using malloc would slow down the fast path too much.
* What is stored in the alloca'd space? Is there a security issue inherent in placing this information at a known offset from the stack pointer? If there is then it might call for using malloc.
* Is the allocated space large? The use of alloca in glibc is limited and large allocations will need to be taken from malloc.
* Does the API allow returning ENOMEM? The use of malloc introduces the possibility that the allocation might fail. If the API doesn't allow ENOMEM to be returned then it might be better to use alloca unless there are other circumstances.
At present there is no magic bullet of special procedure for selecting alloca vs. malloc, if there was then we could encode it into this wiki or into a macro.
~~~
What else do we need?