MemoryXtend for Off-Heap RAM


XAP off-heap Storage mode store space objects off-heap. This mode can be used to reduce the space hosting JVM (GSC) heap utilization. This reduce garbage collection actvity delivering determentic behavior with lower chance having stop-the world pauses.

XAP off-heap using MapDB that is an embedded database engine provides concurrent Maps, Sets and Queues backed by disk storage or off-heap memory. XAP off-heap is part of the MemoryXtend add-on. XAP off-heap support Java 7 (or later)




Creating a space with the MapDB add-on can be done via pu.xml or code. For example:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""

    <blob-store:mapdb-blob-store id="offheapBlobstore"/>

    <os-core:space id="space" url="/./myDataGrid">
       <os-core:blob-store-data-policy persistent="false" blob-store-handler="offheapBlobstore"/>

    <os-core:giga-space id="gigaSpace" space="space"/>
String spaceURL = "/./mySpace";
MapDBBlobStoreConfigurer configurer = new MapDBBlobStoreConfigurer();
MapDBBlobStoreHandler mapDBBlobStoreHandler = configurer.create();

BlobStoreDataCachePolicy cachePolicy = new BlobStoreDataCachePolicy();

UrlSpaceConfigurer urlConfig = new UrlSpaceConfigurer(spaceURL);
GigaSpace gigaSpace = new GigaSpaceConfigurer(;

In addition to the general MemoryXtend configuration options, the MapDB MemoryXtend add-on supports the following configuration options:

Property Description Default Use
write-only-block-percentage Specifies a maximum threshold for off-heap memory use. If the space containers off-heap memory usage exceeds this threshold, a BlobStoreMemoryShortageException is thrown. 80 optional
compaction-interval Specifies the off-heap compaction interval in millis. 30000 optional
compaction-minimal-interval pecifies the off-heap compaction minimal interval in millis. 10000 optional

JVM Configuration

Configure the maximum off-heap(direct) memory that the JVM will allocate: -XX:MaxDirectMemorySize=100G, off-heap(direct) memory is separate from the JVM heap allocated by -Xmx. The value allocated by -XX:MaxDirectMemorySize must not exceed physical RAM, and should likely to be less than total available RAM. Default value of -XX:MaxDirectMemorySize is depends on your JVM version, Oracle Java default is 64mb.

Configuring an IMDG (Space) with BlobStore should be done via the MapDBBlobStoreDataPolicyFactoryBean, or the MapDBBlobStoreConfigurer. For example:

XAP_GSC_OPTIONS="-server -Xms20g -Xmx20g -XX:MaxDirectMemorySize=100g -Xmn6g -XX:+UseG1GC"; export XAP_GSC_OPTIONS