3 ms·
For the heap, JEP 454 is reasonably detailed: https://openjdk.org/jeps/454 https://openjdk.org/jeps/454 It describes how to adopt memory from C and have C ado
by w10-1 2y ago
For the heap, JEP 454 is reasonably detailed: https://openjdk.org/jeps/454 https://openjdk.org/jeps/454
It describes how to adopt memory from C and have C adopt memory you allocate, and gives control over how memory is allocated in an arena.
The arena has lifecycle boundaries, and allocations determine the memory space available. Java guarantees (only) that you can't use unallocated memory or memory outside the arena, and if you access via a (correct) value layout, you should be able to navigate structure correctly.
The interesting stuff is passing function pointers back and forth - look for `downcall method handles`.