public interface MemoryAllocator extends Disposable
Modifier and Type | Field and Description |
---|---|
static long |
NULL_ADDRESS
The special value that does not correspond to an actual address and signals the absence
of an address.
|
Modifier and Type | Method and Description |
---|---|
long |
allocate(long size)
Allocates a block of addresses with the requested size and returns the base address of the
block.
|
void |
free(long address,
long size)
Accepts the base address and size of a previously allocated block and sets it free.
|
long |
reallocate(long address,
long currentSize,
long newSize)
Accepts the base address and size of a previously allocated block and "reallocates" it by either:
Resizing the existing block, if possible.
|
dispose
static final long NULL_ADDRESS
long allocate(long size)
Guarantees that no subsequent call to allocate()
will allocate a block which
overlaps the currently allocated block. The guarantee holds until the block is
free(long, long)
'd.
size
- size of the block to allocateNativeOutOfMemoryError
- if there is not enough free memory to satisfy the reallocation request.long reallocate(long address, long currentSize, long newSize)
newSize
, copying the contents of the old block
into it (up to the new block's size), then freeing the old block.
address
- base address of the blockcurrentSize
- size of the blocknewSize
- requested new block sizeNativeOutOfMemoryError
- if there is not enough free memory to satisfy the reallocation request.void free(long address, long size)
address
- base address of the blocksize
- size of the blockCopyright © 2019 Hazelcast, Inc.. All Rights Reserved.