public interface HazelcastMemoryManager
extends com.hazelcast.internal.memory.MemoryAllocator
MemoryAllocator to CPU's native address space.
Also includes methods specific to Hazelcast's pooling memory managers.| Modifier and Type | Field and Description |
|---|---|
static long |
SIZE_INVALID
Indicates that size of a memory block is not known by this memory manager.
|
| Modifier and Type | Method and Description |
|---|---|
long |
allocate(long size)
Allocates memory from an internal memory pool or falls back to OS
if not enough memory available in pool.
|
void |
compact()
Compacts the memory region.
|
void |
free(long address,
long size)
Gives allocated memory block back to internal pool or to OS
if pool is over capacity.
|
long |
getAllocatedSize(long address)
Returns allocated size of memory block as if it belongs to and is allocated by this memory manager.
|
com.hazelcast.memory.MemoryStats |
getMemoryStats() |
com.hazelcast.internal.memory.MemoryAllocator |
getSystemAllocator() |
long |
getUsableSize(long address)
Returns size of memory block as if it belongs to and is allocated by this memory manager.
|
boolean |
isDisposed()
Gets the disposed state of this memory manager.
|
long |
newSequence()
Creates a new sequence.
|
long |
validateAndGetAllocatedSize(long address)
Returns allocated size of memory block if and only if it belongs to and is allocated by this memory manager.
|
long |
validateAndGetUsableSize(long address)
Returns size of memory block if and only if it belongs to and is allocated by this memory manager.
|
static final long SIZE_INVALID
long allocate(long size)
Complement of free(long, long).
Memory allocated by this method should be freed using
free(long, long)
allocate in interface com.hazelcast.internal.memory.MemoryAllocatorsize - of requested memory blockNativeOutOfMemoryError - if not enough memory is availablevoid free(long address,
long size)
Complement of allocate(long).
Only memory allocated by allocate(long) can be
freed using this method.
free in interface com.hazelcast.internal.memory.MemoryAllocatoraddress - address of memory blocksize - size of memory blockcom.hazelcast.internal.memory.MemoryAllocator getSystemAllocator()
void compact()
boolean isDisposed()
true if this memory manager is destroyed, false otherwisecom.hazelcast.memory.MemoryStats getMemoryStats()
long getUsableSize(long address)
SIZE_INVALID is returned.address - address of memory blockSIZE_INVALID if it's unknownlong validateAndGetUsableSize(long address)
SIZE_INVALID is returned.address - address of memory blockSIZE_INVALID if it's unknownlong getAllocatedSize(long address)
SIZE_INVALID is returned.
Allocated size includes usable memory size plus any header or metadata region size reserved by memory manager.
address - address of memory blockSIZE_INVALID if it's unknowngetUsableSize(long)long validateAndGetAllocatedSize(long address)
SIZE_INVALID is returned.
Allocated size includes usable memory size plus any header or metadata region size reserved by memory manager.
address - address of memory blockSIZE_INVALID if it's unknownvalidateAndGetUsableSize(long)long newSequence()
Use case for this sequence is to avoid ABA problem by using it with the address
to create a "safe pointer" (address, sequence) to a memory block.
Copyright © 2020 Hazelcast, Inc.. All Rights Reserved.