3 ms·
How does something like Graal handle memory when emulating C? I imagine using JVM 1.9 will help?
by Alphasite_ 10y ago
How does something like Graal handle memory when emulating C? I imagine using JVM 1.9 will help?
- sievebrain 10y agoYou can do manual memory allocation in Java using the "unsafe" API. It's relatively common in high performance libraries. There are actually three implementations of C on top of Graal/Truffle by now. TruffleC was the first and it maps malloc to the JVM's Unsafe malloc equivalent. So if you double free you trash the VM basically. ManagedC ignores calls to free() and garbage collects the C programs heap. Sulong interprets LLVM bytecode. I don't know how it does memory management.