@UnstableApi public final class AdaptiveByteBufAllocator extends AbstractByteBufAllocator implements ByteBufAllocatorMetricProvider, ByteBufAllocatorMetric
ByteBufAllocator, that follows an anti-generational hypothesis.
Note: this allocator is experimental. It is recommended to roll out usage slowly, and to carefully monitor application performance in the process.
See the AdaptivePoolingAllocator class documentation for implementation details.
DEFAULT| Constructor and Description |
|---|
AdaptiveByteBufAllocator() |
AdaptiveByteBufAllocator(boolean preferDirect) |
AdaptiveByteBufAllocator(boolean preferDirect,
boolean useCacheForNonEventLoopThreads) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
isDirectBufferPooled()
Returns
true if direct ByteBuf's are pooled |
ByteBufAllocatorMetric |
metric()
Returns a
ByteBufAllocatorMetric for a ByteBufAllocator. |
protected ByteBuf |
newDirectBuffer(int initialCapacity,
int maxCapacity)
Create a direct
ByteBuf with the given initialCapacity and maxCapacity. |
protected ByteBuf |
newHeapBuffer(int initialCapacity,
int maxCapacity)
Create a heap
ByteBuf with the given initialCapacity and maxCapacity. |
long |
usedDirectMemory()
Returns the number of bytes of direct memory used by a
ByteBufAllocator or -1 if unknown. |
long |
usedHeapMemory()
Returns the number of bytes of heap memory used by a
ByteBufAllocator or -1 if unknown. |
buffer, buffer, buffer, calculateNewCapacity, compositeBuffer, compositeBuffer, compositeDirectBuffer, compositeDirectBuffer, compositeHeapBuffer, compositeHeapBuffer, directBuffer, directBuffer, directBuffer, heapBuffer, heapBuffer, heapBuffer, ioBuffer, ioBuffer, ioBuffer, toLeakAwareBuffer, toLeakAwareBuffer, toStringpublic AdaptiveByteBufAllocator()
public AdaptiveByteBufAllocator(boolean preferDirect)
public AdaptiveByteBufAllocator(boolean preferDirect,
boolean useCacheForNonEventLoopThreads)
protected ByteBuf newHeapBuffer(int initialCapacity, int maxCapacity)
AbstractByteBufAllocatorByteBuf with the given initialCapacity and maxCapacity.newHeapBuffer in class AbstractByteBufAllocatorprotected ByteBuf newDirectBuffer(int initialCapacity, int maxCapacity)
AbstractByteBufAllocatorByteBuf with the given initialCapacity and maxCapacity.newDirectBuffer in class AbstractByteBufAllocatorpublic boolean isDirectBufferPooled()
ByteBufAllocatortrue if direct ByteBuf's are pooledisDirectBufferPooled in interface ByteBufAllocatorpublic long usedHeapMemory()
ByteBufAllocatorMetricByteBufAllocator or -1 if unknown.usedHeapMemory in interface ByteBufAllocatorMetricpublic long usedDirectMemory()
ByteBufAllocatorMetricByteBufAllocator or -1 if unknown.usedDirectMemory in interface ByteBufAllocatorMetricpublic ByteBufAllocatorMetric metric()
ByteBufAllocatorMetricProviderByteBufAllocatorMetric for a ByteBufAllocator.metric in interface ByteBufAllocatorMetricProviderCopyright © 2008–2025 The Netty Project. All rights reserved.