In practice I have never had a problem with that and it seems to work well. And I have read that alloca just points to memory on the stack, so it should be as safe as making a new variable. But just wanted to check here if that looks ok?
I use alloca only in very specific cases (mostly in C codes) when i know that the length is small and/or the function call can NOT be recursive… and that efficiency matters (such as in DSP)! I use it only after considered preallocating cached memory on the heap first. The problem with alloca is that it could make your app crash with a stackoverflow (specially with a small stack size on some OS).
My 2 cents.
I quickly looked in my projects to find alloca examples, and it seems that i don’t use any!
I’ve been seeing crash reports from M1 macs that were near a call to alloca. I can’t confirm that is the cause yet, but I’m wondering if sandboxed plugins in Logic have a lot less call stack available to them? Anybody else seen anything like this?