3 ms·
Does the memory created by the LLVM IR get managed by the JVM's garbage collector, or is it manually managed à la C++? If the latter, I feel there's an awesome
by wcrichton 11y ago
Does the memory created by the LLVM IR get managed by the JVM's garbage collector, or is it manually managed à la C++? If the latter, I feel there's an awesome opportunity here for creating a hybrid memory-managed/unmanaged language like Terra (http://terralang.org/ http://terralang.org/) that takes advantage of the massive Java ecosystem while letting people write low-level code when they need performance and full control over memory.
- ianopolous 11y agoMy understanding is they can either use allocation in the JVM heap, or use the Graal foreign function interface to call native malloc, which is useful for inter-operating with native libraries outside the JVM.
- mike_hearn 11y agoIt says this in the presentation. It uses native malloc/free and it can allocate memory on the stack. So - not garbage collected. However, they are interested in changing this so that programs compiled to LLVM can benefit from the additional safety of bounds checking and GC. They've already done this when running C (source code) on Graal/Truffle and the perf hit was manageable. Note that you can already write Java that does manual memory allocation and other non-safe things, and quite a lot of popular Java libraries do exactly that to boost performance.