Does anyone know if alloca() is by some chance not thread safe? I'm working on improving my parallelization library and I keep running into all kinds of erratic behavior (but not stack overflows) when I use alloca() instead of heap as an optimization, but when I disable this optimization, everything seems to work. I do know that several threads are likely calling alloca() at the same time and with requests large enough that their stacks might need to be expanded.
At first, I thought this was just a symptom of a subtle race condition, but I tried inserting sleep statements and synchronized blocks in various places around the alloca() calls to change the timing of things and the conclusion is the same: malloc() works, alloca() doesn't.
