[LLVMdev] allocating an array
Duncan Sands
baldrick at free.fr
Tue Jul 22 05:34:04 PDT 2008
Hi,
> Now I'm wondering: do you think it's a bad idea to use alloca for
> allocating an unknown number of elements? In that case, should I just
> always use the malloc instruction instead, or do a runtime decision to
> choose between alloca and malloc?
on some operating systems there is a limit to how much you can allocate
on the stack. This is 16k on windows and something bigger but not huge
on Sun OS (IIRC). On the other hand, allocating things on the stack is
usually more efficient than using malloc.
Ciao,
Duncan.
More information about the llvm-dev
mailing list