Skip to content
Tech News
← Back to articles

Library for fast mapping of Java records to native memory

read original get Java Native Memory Mapper → more articles
Why This Matters

TypedMemory is a Java library that simplifies working with off-heap memory by providing type-safe, high-performance abstractions for mapping Java records to native memory. It enhances native interop, data-oriented programming, and high-performance workloads by offering a more expressive and safer way to manage low-level memory operations. This development is significant for the Java ecosystem, especially in systems programming, graphics, and large data handling, where efficient memory management is critical.

Key Takeaways

TypedMemory

Typed off-heap memory for Java 25 and greater.

TypedMemory is a Java library for working with contiguous off-heap memory through strongly typed views. It builds on the Java Foreign Function & Memory (FFM) API and lets you map Java record types onto native memory with a simple, expressive API.

Instead of manually managing layouts, offsets, and low-level access patterns for every structure, TypedMemory gives you a type-safe abstraction over memory while still preserving the low-level control needed for systems, interop, graphics, simulation, and data-oriented programming.

import module com . mamba . typedmemory ; record Point ( float x , float y ) {} void main () { try ( Arena arena = Arena . ofConfined ()) { Mem < Point > points = Mem . of ( Point . class , arena , 10 ); points . set ( 0 , new Point ( 5 , 3 )); Point point = points . get ( 0 ); IO . println ( point ); } }

Why TypedMemory?

Working directly with raw memory in Java is powerful, but often verbose and repetitive.

TypedMemory aims to make off-heap programming feel more natural by providing:

Strongly typed views over contiguous memory

over contiguous memory Record-based schemas for describing structured data

... continue reading