clij-coremem


License

License

Simplified BSD License
Categories

Categories

Net CLI User Interface
GroupId

GroupId

net.haesleinhuepf
ArtifactId

ArtifactId

clij-coremem
Last Version

Last Version

2.3.0.4
Release Date

Release Date

Type

Type

jar
Description

Description

clij-coremem
clij-coremem
Project URL

Project URL

https://github.com/clij/clij
Project Organization

Project Organization

MPI CBG
Source Code Management

Source Code Management

https://github.com/clij/clij-coremem

Download clij-coremem

How to add to project

<!-- https://jarcasting.com/artifacts/net.haesleinhuepf/clij-coremem/ -->
<dependency>
    <groupId>net.haesleinhuepf</groupId>
    <artifactId>clij-coremem</artifactId>
    <version>2.3.0.4</version>
</dependency>
// https://jarcasting.com/artifacts/net.haesleinhuepf/clij-coremem/
implementation 'net.haesleinhuepf:clij-coremem:2.3.0.4'
// https://jarcasting.com/artifacts/net.haesleinhuepf/clij-coremem/
implementation ("net.haesleinhuepf:clij-coremem:2.3.0.4")
'net.haesleinhuepf:clij-coremem:jar:2.3.0.4'
<dependency org="net.haesleinhuepf" name="clij-coremem" rev="2.3.0.4">
  <artifact name="clij-coremem" type="jar" />
</dependency>
@Grapes(
@Grab(group='net.haesleinhuepf', module='clij-coremem', version='2.3.0.4')
)
libraryDependencies += "net.haesleinhuepf" % "clij-coremem" % "2.3.0.4"
[net.haesleinhuepf/clij-coremem "2.3.0.4"]

Dependencies

compile (3)

Group / Artifact Type Version
com.nativelibs4java : bridj jar 0.7.0
net.java.dev.jna : jna jar 4.5.2
net.java.dev.jna : jna-platform jar 4.5.1

test (1)

Group / Artifact Type Version
junit : junit jar 4.13

Project Modules

There are no modules declared in this project.

Build Status

CoreMem

CoreMem is an library that provided access to off-heap memory, and offers a high-level API for handling such memory. Moreover, Coremem facilitates interoperability with libraries such as BridJ and JNA that provide low-level access to native libraries.

Basic Examples

Allocate an off-heap memory regions of 100 floats:

OffHeapMemory.allocateFloats(100)

Allocate a large page-aligned memory region:

OffHeapMemory.allocatePageAlignedBytes(1000000)

These memory regions get automatically 'freed' once you lose a reference to the object.

You can read and write different primitive types to these memory regions:

memory = OffHeapMemory.allocateFloats(100)
memory.setFloat(1, (byte) 255);        // the offset is in /byte/  units
memory.setFloatAligned(1, (byte) 255); // the offset is in /float/ units

memory.getDouble(1);        // the offset is in /byte/  units
memory.getIntAligned(2);    // the offset is in /int/ units (32 bits)
...

You can also use a 'buffer' API that keeps track of a current read and write index:

ContiguousBuffer buffer = ContiguousBuffer.allocate(124);
buffer.setPosition(100);
buffer.pushPosition();
buffer.writeFloat(1.0f);
buffer.writeFloat(1.0f);
buffer.writeFloat(1.0f);
buffer.writeFloat(1.0f);
buffer.popPosition();
buffer.readFloat();
...

There is also support for non-contiguous /fragmented/ memory regions:

ContiguousMemoryInterface memory = OffHeapMemory.allocateShorts(3 * 5);
FragmentedMemory lSplit = FragmentedMemory.split(lMemory, 3);

Other features

CoreMem also supports:

  • Interoperability with BridJ and JNA pointers as well as NIO buffers.
  • File memory mapping.
  • Recycler pattern: mechanism for reusing ressource-heavy objects like 3D stacks that use off-heap memory).
  • Resource garbage collection API: design your own release-just-before-garbage-collection scheme -- inspired by how it is done in NIO.

Maven Dependency

Artifact:

compile 'net.coremem:coremem:0.4.5'

Add the JCenter repository:

repositories {  
   jcenter()  
}

If you want to know what is the official latest release, check the contents of this file.

How to build project with Gradle

This project uses the gradle wrapper, which means that you don't need to setup gradle on your machine, it comes within this repo.

To build and generate an eclipse project, just do:

./gradlew build cleanEclipse eclipse

Contributors

  • Loic Royer (loic.royer -at- czbiohub -point- org)
  • Robert Haase (robert.haase -at- mpi-cbg.de)
net.haesleinhuepf

clij

GPU-accelerated image processing for everyone

Versions

Version
2.3.0.4
2.3.0.3
2.3.0.0