Heap memory allocation

I’m implementing a lazy functional language and I need to allocate nodes on the heap. From what I’ve read LLVM supports only the ‘alloca’ instruction which allows to allocate memory on the stack. Is this true and and if so, what is the preferred way to solve my problem?

Yup, that's true; the 'malloc' instruction has been removed a while
ago. If I recall correctly, the preferred way is to declare and call
the C function "malloc" instead. Of course, the size of its argument
may change from system to system (e.g. i32 on 32-bit systems and i64
on 64-bit ones).

Cheers,
~~ Ondra

Hi,

you could call to libc malloc function to allocate heap memory. There may also be more efficient, but more complex methods.

Cheers
Tobi