Skip to content

Memory Allocator

Jule uses its own specialized heap allocator optimized specifically for Jule programs. The Jule runtime, code generated by the compiler, and the internal API all rely on this allocator. Written in Pure Jule, the allocator is implemented directly by the Jule runtime and operates fully integrated with it.

By default, Jule prepares and manages the allocator for you, there is nothing special you need to consider if you are developing in Pure Jule. However, when working with interoperability or other features that enabling code emitting, you must pay close attention to allocation dynamics. Because the Jule API depends on the allocator and the allocator itself is initialized by the Jule runtime, attempting to allocate heap memory before the runtime has started (such as initializing a global variable that requires heap allocation within custom C++ code) will result in undefined behavior.