Skip to content

bhf/st-learning-java-arenas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StayTuned

st-learning-arenas

Learning example for Java Arenas and Memory Segments.

Arena example

A minimal runnable example demonstrating native allocations using an "arena" is provided in src/main/java/com/bhf/learning/memory/ArenaExample.java.

Requirements:

  • JDK with the java.lang.foreign API (tested on JDK 24).

Build and run from the project root using the Gradle wrapper:

# Compile
./gradlew clean build

# Run the example class directly
java -cp build/classes/java/main com.bhf.learning.memory.ArenaExample

Expected output:

Java Arena (MemorySession) example
Written ints (native): 10, 20, 30, 40
Read string (native): Hello Arena
Arena closed — native memory freed.

If your JDK doesn't expose java.lang.foreign.MemorySession (older releases), the project uses java.lang.foreign.Arena when available; ensure you run with an appropriate Java version.

About

st-learning: Java Arenas Learning Examples

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages