MemoryManager implementation based on a series of shared memory pools. Each pool contains multiple buffers
of the fixed length specific for this pool.
There are several tuning options for this MemoryManager implementation.
Buffers will be allocatedDEFAULT_BASE_BUFFER_SIZE)DEFAULT_NUMBER_OF_POOLS)DEFAULT_GROWTH_FACTOR), which means the first buffer pool will contains buffer of size
4 KiB, the seconds one buffer of size 16KiB, the third one buffer of size 64KiBRuntime.getRuntime().availableProcessors()DEFAULT_HEAP_USAGE_PERCENTAGE)DEFAULT_PREALLOCATED_BUFFERS_PERCENTAGE)Buffers will be allocatedorg.glassfish.grizzly.memory.HeapMemoryManager or
org.glassfish.grizzly.memory.ByteBufferManager is that this implementation doesn't use ThreadLocal pools and
as such, doesn't suffer from the memory fragmentation/reallocation cycle that can impact the ThreadLocal versions.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class | |
| pack-priv static interface | |
| private static class | |
| private static class | |
| pack-priv static class |
| Modifier and Type | Field and Description |
|---|---|
| private static final long | |
| public static final int | |
| public static final int | |
| public static final float | |
| public static final int | |
| public static final float | |
| private static final boolean | |
| private final int | |
| protected final DefaultMonitoringConfig | monitoringConfig
Basic monitoring support. |
| private final PooledMemoryManager. |
| Access | Constructor and Description |
|---|---|
| public | PooledMemoryManager()
Creates a new
|
| public | PooledMemoryManager(final boolean
flag, indicating whether direct or heap based isDirect)Buffers will be allocatedCreates a new |
| public | PooledMemoryManager(final int
the base size of the buffer for the 1st pool, every next pool n will have buffer size equal to
bufferSize(n-1) * 2^growthFactor baseBufferSize, final int the number of pools, responsible for allocation of buffers of a pool-specific size numberOfPools, final int the buffer size growth factor, that defines 2^x multiplier, used to calculate buffer size for
next allocated pool growthFactor, final int the number of pool slices that every pool will stripe allocation requests across numberOfPoolSlices, final float percentage of the heap that will be used when populating the pools percentOfHeap, final float percentage of buffers to be pre-allocated during MemoryManager initialization percentPreallocated, final boolean flag, indicating whether direct or heap based isDirect)Buffers will be allocatedCreates a new |
| Modifier and Type | Method and Description |
|---|---|
| public Buffer | allocate(final int size)
Implements org. For this implementation, this method simply calls through to |
| public Buffer | Returns: a buffer with a limit of the specified size.the min size)Buffer size to be allocated.Implements org. Allocates a buffer of at least the size requested. |
| private CompositeBuffer | |
| protected Object | |
| private static int | |
| public MonitoringConfig | getMonitoringConfig()
Implements org. Return the object associated |
| private PooledMemoryManager. | |
| pack-priv PooledMemoryManager. | |
| private static boolean | |
| private CompositeBuffer | |
| public Buffer | Returns: potentially a new buffer of at least the specified size.old oldBuffer, final int Buffer to be reallocated.new newSize)Buffer required size.Implements org. Reallocates an existing buffer to at least the specified size. |
| public void | release(final Buffer buffer)
Implements org. Release |
| public boolean | willAllocateDirect(final int size)
Implements org. Return true if next |
| public Buffer | wrap(final byte[] data)
Implements org. Returns |
| public Buffer | wrap(byte[] data, int offset, int length)
Implements org. Returns |
| public Buffer | |
| public Buffer | |
| public Buffer | wrap(final ByteBuffer byteBuffer)
Implements org. Returns |