Java Clean Architecture Masterclass

Java Clean Architecture Masterclass28-29 May

Join

JDK & OS Matrix CI Maven Central Latest Version Coveralls Main Branch Test Coverage

=================

DataSketches Memory Project

This Memory Project was initially developed to enable the DataSketches Java Project to manage off-heap data structures efficiently. The first version was developed as an internal project at Yahoo in 2014 using Java 8 and released to open source in 2015. This Memory Project is general purpose, has no external runtime dependencies and can be used in any application that needs to manage data structures on or off the Java heap.

Basic Capabilities

To make this useful, this project also provided:

Capability Set A:

Providing these capabilities without sacrificing performance required leveraging internal JVM classes such as Unsafe, FileChannelImpl, DirectBuffer, MappedByteBuffer internals and sun.nio.ch.

However, starting with Java 11, Oracle started restricting access to a many JVM internal classes. With Java 17 the internals of FileChannelImpl and MappedByteBuffer were hidden or relocated. This blocked the ability to provide direct access to file-mapped memory.

Meanwhile, the Java Panama project, which had the potential to provide all the above capabilities as part of the Java language, became available as the Foreign Function and Memory (FFM) API in the form of "Incubation" code in Java 17 and as "Preview" code in Java 21. In Java 25 many of the methods of Unsafe have been marked "Deprecated". They are still available, but will cause deprecation warnings especially at compile time.

Unfortunately, the DataSketches Memory Project releases 4.X, 5.X and 6.X for Java 17 and 21 were developed using the Incubation and Preview versions of FFM not realizing that Incubation and Preview codes are only available until the next java version is released, after which they are no longer available.

The actual LTS release of FFM did not occur until Java 25 was released on September 16, 2025. Since Java 17 was released on September 14, 2021, there is a gap of 4 years where Oracle had blocked access to internals of the JVM without providing a LTS release API with comparable capabilities. This means that for the LTS Java versions 17, 21, and 25, the DataSketches Memory Project can not provide access to file-mapped memory. Nonetheless, it is still possible to provide the following capabilities:

Capability Set B:

The objective of this 7.X release of the Memory Project is to provide Capability Set A with Java 11 and Capability Set B for Java versions 17 and 21, for users that are still dependent on the these older LTS releases. Java 25 was added for certain systems that required a single jar across Java versions 17, 21, and 25.

In addition, with this release the build code has been completely refactored:

Because the FFM capabilities built into Java 25 (released September, 2025) are a major superset of this Memory Project's capabilities (open sourced in 2015), all of these capabilities are now available directly from the Java Language. There is little reason to continue to provide new releases of this project. Alas, this project must come to an end. Any further releases will only be for bug fixes. Nonetheless, we were able to provide these fast, low-level, off-heap memory capabilities for 10 years before the Java language finally provided it.

Comments about ByteBuffer

Although the ByteBuffer provides similar capabilities, it has some severe limitations.


Release Comments

For Use With Java 8

Please download datasketches-memory 3.X from the website downloads page and refer to the README.md there. The 3.X set of releases will be the last that support Java 8.

Releases 4.X, 5.X and 6.X

Deprecated with the 7.X releases.

Releases 7.X (THIS RELEASE)

Artifact: datasketches-memory-java11 (Capability Set A)

This artifact is compiled with Java 11 and can only be used with Java 11

Artifact: datasketches-memory-java17_25 (Capability Set B)

This artifact is compiled with Java 17 and can be used with Java 17, 21, and 25+. There is no guarantee that this code base will continue to work beyond Java 25. Caveat Emptor.


LIBRARY USAGE (using jars from Maven Central)

In this environment, the user is using the Jars from Maven Central as a library dependency and not attempting to build this Memory Project from the source code.

If you are running Java 11 you must use artifact datasketches-memory-java11

You will need to add these java modular arguments to your JVM:

If you are running Java 17, 21, or 25 you must use artifact datasketches-memory-java17_25

You will need to add these java modular arguments to your JVM:

DEVELOPER USAGE

In this environment the developer needs to build the Memory component from source and run the Memory Component tests.

Maven Build Instructions

NOTES:

TESTS:

To run normal unit tests on the forked site:

To run javadoc on this multi-module project, use:

To install the jars in ~/.m2

This will create the following sets of Jars and POMs, with associated GPG .asc signatures (not listed here) in the folder ~/.m2/repository/org/apache/datasketches/ and under

To deploy the jars to Maven Central

This will upload the two sets of jars above as two distinct artifact IDs but in one upload batch. You must log into Nexus / Staging Repositories and close the upload until you are ready to actually release.

Helpful Github Workflows


Please visit the main DataSketches website for more information about the DataSketches Library and all the different languages it is available in.

If you are interested in making contributions to this Memory Project or to any of the other DataSketches Projects please visit our Community page.

- LR

Join libs.tech

...and unlock some superpowers

GitHub

We won't share your data with anyone else.