When a Java Programmer Meets C
summary
Java 22 exposes a Foreign Memory & Foreign Function API that lets code allocate off‑heap via memory segment arenas (global, confined, shared), define C‑style layouts and varhandles, and thus sidestep GC pauses for very large datasets. The API provides a linker to call C libraries (Intel64/ARM64 on Windows/Linux) without JNI, producing method handles for functions like getpid, installing upcall stub callbacks (signal handlers), and running POSIX mq examples between Java processes; C++ interop is not supported.
AI-written summary · about
chapters (9)
- 0:00Introduction and speaker intro
- 10:54History of low-level Java
- 13:00Foreign Memory API overview
- 22:35Memory layouts and structs
- 27:08Foreign Functions API explained
- 34:48Calling C from Java demo
- 39:59Upcall stubs and safety
- 41:28Practical use cases and benefits
- 47:20Future possibilities and Q&A
related talks
47mInterconnecting Java and Native Code with the FFM API
16mForeign Function and Memory API
01h 01mJava Enable Preview: Foreign Function and Memory Interface
51mNative Interoperability with JDK 25 and the FFM API
55mBare metal Java
01h 01mNative Code, Off-Heap Data and Java
45mProject Panama - Foreign Function & Memory API
02h 39mMemory API: Patterns, Uses Cases, and Performance
