Roray FFM Utils Quickstart
Early Development Notice
All MVP.Express projects are currently in active development (pre-1.0.0) and should not be used in production environments. APIs may change without notice, and breaking changes are expected until each project reaches version 1.0.0. We welcome early adopters and contributors, but please use at your own risk.
Get started with high-performance memory management in 5 minutes.
Prerequisites
- Java 24+ with preview features enabled
- Gradle 8.5+ or Maven 3.9+
Installation
Add to your build.gradle.kts:
dependencies {
implementation("express.mvp.roray:roray-ffm-utils:0.2.1")
}
Quick Example
Memory Segment Pool
Efficiently allocate and release off-heap memory:
;
;
// Create a pool with 64 segments of 4KB each
var pool ;
// Borrow a segment (zero-allocation after warmup)
MemorySegment segment ;
try finally
Zero-Copy String Handling
Work with UTF-8 strings without allocating:
;
// Wrap a memory region as a UTF-8 view
Utf8View view ;
// Compare strings without allocation
if
// Convert to String only when needed
String str ;
JVM Arguments
Enable FFM preview features:
For Gradle:
tasks.withType<JavaCompile> {
options.compilerArgs.add("--enable-preview")
}
tasks.withType<JavaExec> {
jvmArgs("--enable-preview", "--enable-native-access=ALL-UNNAMED")
}
Next Steps
- User Guide - In-depth patterns and best practices
- API Reference - Complete API documentation
- Benchmarks - Performance comparisons