Foreign Function and Memory API
A Java API for interoperating with native code and accessing off-heap memory without relying on traditional JNI-style bindings for every operation.
JVM Runtime Context
The Foreign Function and Memory API provides Java abstractions for calling native functions and accessing off-heap memory without requiring a JNI binding for every operation. MemorySegment and Arena provide bounds and lifetime controls, while linker descriptors describe native downcalls and upcalls.
Native-Code Boundary
The API improves type and lifetime modeling on the Java side but cannot make arbitrary native code memory-safe. An incorrect C ABI description, invalid native pointer, or defect inside a native library can still corrupt or terminate the process.
Related JVM Concepts
- Memory Segment
- Arena
- JNI
- Native Interop
Source
- https://openjdk.org/jeps/454