[id='off-heap-storage_{context}']
= Off-heap data storage

When you add entries to off-heap caches, {brandname} dynamically allocates native memory to your data.

{brandname} hashes the serialized `byte[]` for each key into buckets that are similar to a standard Java `HashMap`.
Buckets include address pointers that {brandname} uses to locate entries that you store in off-heap memory.

[IMPORTANT]
====
Even though {brandname} stores cache entries in native memory, run-time operations require JVM heap representations of those objects.
For instance, `cache.get()` operations read objects into heap memory before returning.
Likewise, state transfer operations hold subsets of objects in heap memory while they take place.
====

.Object equality

{brandname} determines equality of Java objects in off-heap storage using the serialized byte[] representation of each object instead of the object instance.

.Data consistency

{brandname} uses an array of locks to protect off-heap address spaces.
The number of locks is twice the number of cores and then rounded to the nearest power of two.
This ensures that there is an even distribution of `ReadWriteLock` instances to prevent write operations from blocking read operations.
