java.lang.Object | ||
↳ | org.apache.directmemory.memory.allocator.AbstractByteBufferAllocator | |
↳ | org.apache.directmemory.memory.allocator.MergingByteBufferAllocator |
Allocator
implementation with ByteBuffer merging capabilities.
setMinSizeThreshold(int)
gives the minimum buffer's size under which no splitting is done.
setSizeRatioThreshold(double)
gives the size ratio (requested allocation / free buffer's size} under which no splitting is done
The free ByteBuffer are held into a NavigableMap with keys defining the size's range : 0 -> first key (included), first key -> second key (included), ...
Instead of keeping a list of ByteBuffers sorted by capacity, ByteBuffers in the same size's range are held in the same collection.
The size's range are computed by generateFreeSizesRange(long)
and can be overridden.
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.apache.directmemory.memory.allocator.AbstractByteBufferAllocator
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Constructor.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Generate free sizes' range.
| |||||||||||
Initialization function.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.apache.directmemory.memory.allocator.AbstractByteBufferAllocator
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
java.io.Closeable
| |||||||||||
From interface
org.apache.directmemory.memory.allocator.Allocator
|
Constructor.
number | : the internal buffer identifier |
---|---|
totalSize | : total size of the parent buffer. |
Generate free sizes' range. Sizes' range are used to try to allocate the best matching {@ByteBuffer } regarding the requested size. Instead of using a sorted structure, arbitrary size's range are computed.
Initialization function. Create an initial free LinkedByteBuffer mapping the whole buffer.