| Modifier and Type | Class and Description |
|---|---|
| pack-priv class |
| Modifier and Type | Field and Description |
|---|---|
| private final AllocationType | |
| private final List | |
| private final List | |
| private final PoolArena[] | |
| private final int | |
| private volatile boolean | |
| private static final int | |
| private static final long | |
| private static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| private static final int | |
| private static final int | |
| private static final int | |
| private static final int | |
| private static final int | |
| private static final int | |
| private static final boolean | |
| private static final InternalLogger | |
| private final MemoryManager | |
| private static final int | |
| private final PooledBufferAllocatorMetric | |
| private static final int | |
| private final int | |
| private final AllocatorControl | |
| private final int | |
| private final PooledBufferAllocator. | |
| private final Runnable |
| Access | Constructor and Description |
|---|---|
| public | |
| public | PooledBufferAllocator(MemoryManager manager, boolean direct, int numArenas, int pageSize, int maxOrder)
|
| public | PooledBufferAllocator(MemoryManager manager, boolean direct, int numArenas, int pageSize, int maxOrder, int smallCacheSize, int normalCacheSize, boolean useCacheForAllThreads)
|
| public | PooledBufferAllocator(MemoryManager manager, boolean direct, int numArenas, int pageSize, int maxOrder, int smallCacheSize, int normalCacheSize, boolean useCacheForAllThreads, int directMemoryCacheAlignment)
|
| Modifier and Type | Method and Description |
|---|---|
| public Buffer | allocate(int
The size of size)Buffer to allocate.Implements io. Buffer of the given size in bytes.
|
| private UntetheredMemory | |
| pack-priv UntetheredMemory | |
| pack-priv List | |
| pack-priv final int | |
| public void | close()
Implements io. |
| public Supplier | constBufferSupplier(byte[]
The byte contents of the buffers produced by the returned supplier. bytes)Implements io. |
| public static int | |
| public static int | defaultNormalCacheSize()
Default normal cache size - System Property: io.netty5.allocator.normalCacheSize - default 64 |
| public static int | defaultNumDirectArena()
Default number of direct arenas - System Property: io.netty5.allocator.numDirectArenas - default 2 * cores |
| public static int | defaultNumHeapArena()
Default number of heap arenas - System Property: io.netty5.allocator.numHeapArenas - default 2 * cores |
| public static int | defaultPageSize()
Default buffer page size - System Property: io.netty5.allocator.pageSize - default 8192 |
| public static boolean | defaultPreferDirect()
Default prefer direct - System Property: io.netty5.noPreferDirect - default false |
| public static int | defaultSmallCacheSize()
Default small cache size - System Property: io.netty5.allocator.smallCacheSize - default 256 |
| public static boolean | defaultUseCacheForAllThreads()
Default thread caching behavior - System Property: io.netty5.allocator.useCacheForAllThreads - default true |
| public String | |
| public AllocationType | getAllocationType()
Implements io. AllocationType from this allocator.
|
| pack-priv final AllocatorControl | |
| public boolean | |
| public static boolean | isDirectMemoryCacheAlignmentSupported()
Return |
| public boolean | isPooling()
Implements io. |
| pack-priv static PoolArena | |
| public BufferAllocatorMetric | metric()
Implements io. BufferAllocatorMetric for a BufferAllocator.
|
| private static PoolArena[] | |
| pack-priv int | |
| public int | |
| pack-priv int | |
| pack-priv final long | |
| private static long | |
| pack-priv int | |
| pack-priv final PoolThreadCache | |
| public boolean | trimCurrentThreadCache()
Trim thread local cache for the current |
| pack-priv final long | |
| private static long | |
| private static int | |
| private static int |
| allocationType | back to summary |
|---|---|
| private final AllocationType allocationType | |
| arenaMetrics | back to summary |
|---|---|
| private final List<PoolArenaMetric> arenaMetrics | |
| arenaMetricsView | back to summary |
|---|---|
| private final List<PoolArenaMetric> arenaMetricsView | |
| arenas | back to summary |
|---|---|
| private final PoolArena[] arenas | |
| chunkSize | back to summary |
|---|---|
| private final int chunkSize | |
| closed | back to summary |
|---|---|
| private volatile boolean closed | |
| DEFAULT_CACHE_TRIM_INTERVAL | back to summary |
|---|---|
| private static final int DEFAULT_CACHE_TRIM_INTERVAL | |
| DEFAULT_CACHE_TRIM_INTERVAL_MILLIS | back to summary |
|---|---|
| private static final long DEFAULT_CACHE_TRIM_INTERVAL_MILLIS | |
| DEFAULT_DIRECT_MEMORY_CACHE_ALIGNMENT | back to summary |
|---|---|
| private static final int DEFAULT_DIRECT_MEMORY_CACHE_ALIGNMENT | |
| DEFAULT_MAX_CACHED_BUFFER_CAPACITY | back to summary |
|---|---|
| pack-priv static final int DEFAULT_MAX_CACHED_BUFFER_CAPACITY | |
| DEFAULT_MAX_CACHED_BYTEBUFFERS_PER_CHUNK | back to summary |
|---|---|
| pack-priv static final int DEFAULT_MAX_CACHED_BYTEBUFFERS_PER_CHUNK | |
| DEFAULT_MAX_ORDER | back to summary |
|---|---|
| private static final int DEFAULT_MAX_ORDER | |
| DEFAULT_NORMAL_CACHE_SIZE | back to summary |
|---|---|
| private static final int DEFAULT_NORMAL_CACHE_SIZE | |
| DEFAULT_NUM_DIRECT_ARENA | back to summary |
|---|---|
| private static final int DEFAULT_NUM_DIRECT_ARENA | |
| DEFAULT_NUM_HEAP_ARENA | back to summary |
|---|---|
| private static final int DEFAULT_NUM_HEAP_ARENA | |
| DEFAULT_PAGE_SIZE | back to summary |
|---|---|
| private static final int DEFAULT_PAGE_SIZE | |
| DEFAULT_SMALL_CACHE_SIZE | back to summary |
|---|---|
| private static final int DEFAULT_SMALL_CACHE_SIZE | |
| DEFAULT_USE_CACHE_FOR_ALL_THREADS | back to summary |
|---|---|
| private static final boolean DEFAULT_USE_CACHE_FOR_ALL_THREADS | |
| logger | back to summary |
|---|---|
| private static final InternalLogger logger | |
| manager | back to summary |
|---|---|
| private final MemoryManager manager | |
| MAX_CHUNK_SIZE | back to summary |
|---|---|
| private static final int MAX_CHUNK_SIZE | |
| metric | back to summary |
|---|---|
| private final PooledBufferAllocatorMetric metric | |
| MIN_PAGE_SIZE | back to summary |
|---|---|
| private static final int MIN_PAGE_SIZE | |
| normalCacheSize | back to summary |
|---|---|
| private final int normalCacheSize | |
| pooledAllocatorControl | back to summary |
|---|---|
| private final AllocatorControl pooledAllocatorControl | |
| smallCacheSize | back to summary |
|---|---|
| private final int smallCacheSize | |
| threadCache | back to summary |
|---|---|
| private final PooledBufferAllocator. | |
| trimTask | back to summary |
|---|---|
| private final Runnable trimTask | |
| PooledBufferAllocator | back to summary |
|---|---|
| public PooledBufferAllocator(MemoryManager manager, boolean direct) | |
| PooledBufferAllocator | back to summary |
|---|---|
| public PooledBufferAllocator(MemoryManager manager, boolean direct, int numArenas, int pageSize, int maxOrder) | |
| PooledBufferAllocator | back to summary |
|---|---|
| public PooledBufferAllocator(MemoryManager manager, boolean direct, int numArenas, int pageSize, int maxOrder, int smallCacheSize, int normalCacheSize, boolean useCacheForAllThreads) | |
| PooledBufferAllocator | back to summary |
|---|---|
| public PooledBufferAllocator(MemoryManager manager, boolean direct, int numArenas, int pageSize, int maxOrder, int smallCacheSize, int normalCacheSize, boolean useCacheForAllThreads, int directMemoryCacheAlignment) | |
| allocate | back to summary |
|---|---|
| public Buffer allocate(int size) Implements io. Doc from io. Allocate a The buffer will use big endian byte order. Note unlike the JDK | |
| allocateUnpooled | back to summary |
|---|---|
| private UntetheredMemory allocateUnpooled(int size) | |
| allocateUntethered | back to summary |
|---|---|
| pack-priv UntetheredMemory allocateUntethered(int size) | |
| arenaMetrics | back to summary |
|---|---|
| pack-priv List Return a | |
| chunkSize | back to summary |
|---|---|
| pack-priv final int chunkSize() Return the chunk size for an arena. | |
| close | back to summary |
|---|---|
| public void close() Implements io. Doc from io. Close this allocator, freeing all of its internal resources. Existing (currently in-use) allocated buffers will not be impacted by calling this method. If this is a pooling or caching allocator, then existing buffers will be immediately freed when they are closed, instead of being pooled or cached.
The allocator can no longer be used to allocate more buffers after calling this method.
Attempting to allocate from a closed allocator will cause
| |
| constBufferSupplier | back to summary |
|---|---|
| public Supplier Implements io. Doc from io. Create a supplier of "constant" Buffers from this allocator, that all have the given byte contents. The buffer has the same capacity as the byte array length, and its write offset is placed at the end, and its read offset is at the beginning, such that the entire buffer contents are readable. The buffers produced by the supplier will each have their own independent life-cycle, and closing them will make them inaccessible, just like normally allocated buffers. The buffers produced are "constants", in the sense that they are read-only. It can generally be expected, but is not guaranteed, that the returned supplier is more resource efficient than allocating and copying memory with other available APIs. In such optimised implementations, the underlying memory baking the buffers will be shared among all the buffers produced by the supplier.
The primary use case for this API, is when you need to repeatedly produce buffers with the same contents, and
you perhaps wish to keep a | |
| defaultMaxOrder | back to summary |
|---|---|
| public static int defaultMaxOrder() Default maximum order - System Property: io.netty5.allocator.maxOrder - default 11 | |
| defaultNormalCacheSize | back to summary |
|---|---|
| public static int defaultNormalCacheSize() Default normal cache size - System Property: io.netty5.allocator.normalCacheSize - default 64 | |
| defaultNumDirectArena | back to summary |
|---|---|
| public static int defaultNumDirectArena() Default number of direct arenas - System Property: io.netty5.allocator.numDirectArenas - default 2 * cores | |
| defaultNumHeapArena | back to summary |
|---|---|
| public static int defaultNumHeapArena() Default number of heap arenas - System Property: io.netty5.allocator.numHeapArenas - default 2 * cores | |
| defaultPageSize | back to summary |
|---|---|
| public static int defaultPageSize() Default buffer page size - System Property: io.netty5.allocator.pageSize - default 8192 | |
| defaultPreferDirect | back to summary |
|---|---|
| public static boolean defaultPreferDirect() Default prefer direct - System Property: io.netty5.noPreferDirect - default false | |
| defaultSmallCacheSize | back to summary |
|---|---|
| public static int defaultSmallCacheSize() Default small cache size - System Property: io.netty5.allocator.smallCacheSize - default 256 | |
| defaultUseCacheForAllThreads | back to summary |
|---|---|
| public static boolean defaultUseCacheForAllThreads() Default thread caching behavior - System Property: io.netty5.allocator.useCacheForAllThreads - default true | |
| dumpStats | back to summary |
|---|---|
| public String dumpStats() Returns the status of the allocator (which contains all metrics) as string. Be aware this may be expensive and so should not be called too frequently. | |
| getAllocationType | back to summary |
|---|---|
| public AllocationType getAllocationType() Implements io. Doc from io. Get the
| |
| getPooledAllocatorControl | back to summary |
|---|---|
| pack-priv final AllocatorControl getPooledAllocatorControl() | |
| isDirectBufferPooled | back to summary |
|---|---|
| public boolean isDirectBufferPooled() | |
| isDirectMemoryCacheAlignmentSupported | back to summary |
|---|---|
| public static boolean isDirectMemoryCacheAlignmentSupported() Return | |
| isPooling | back to summary |
|---|---|
| public boolean isPooling() Implements io. Doc from io. Determine if this allocator is pooling and reusing its allocated memory.
| |
| leastUsedArena | back to summary |
|---|---|
| pack-priv static PoolArena leastUsedArena(PoolArena[] arenas) | |
| metric | back to summary |
|---|---|
| public BufferAllocatorMetric metric() Implements io. Doc from io. Returns a
| |
| newArenaArray | back to summary |
|---|---|
| private static PoolArena[] newArenaArray(int size) | |
| normalCacheSize | back to summary |
|---|---|
| pack-priv int normalCacheSize() Return the size of the normal cache. | |
| numArenas | back to summary |
|---|---|
| public int numArenas() | |
| numThreadLocalCaches | back to summary |
|---|---|
| pack-priv int numThreadLocalCaches() Return the number of thread local caches used by this | |
| pinnedMemory | back to summary |
|---|---|
| pack-priv final long pinnedMemory() | |
| pinnedMemory | back to summary |
|---|---|
| private static long pinnedMemory(PoolArena[] arenas) | |
| smallCacheSize | back to summary |
|---|---|
| pack-priv int smallCacheSize() Return the size of the small cache. | |
| threadCache | back to summary |
|---|---|
| pack-priv final PoolThreadCache threadCache() | |
| trimCurrentThreadCache | back to summary |
|---|---|
| public boolean trimCurrentThreadCache() Trim thread local cache for the current
| |
| usedMemory | back to summary |
|---|---|
| pack-priv final long usedMemory() | |
| usedMemory | back to summary |
|---|---|
| private static long usedMemory(PoolArena[] arenas) | |
| validateAndCalculateChunkSize | back to summary |
|---|---|
| private static int validateAndCalculateChunkSize(int pageSize, int maxOrder) | |
| validateAndCalculatePageShifts | back to summary |
|---|---|
| private static int validateAndCalculatePageShifts(int pageSize, int alignment) | |
| Modifier and Type | Field and Description |
|---|---|
| private final boolean |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| protected synchronized PoolThreadCache | initialValue()
Overrides io. |
| protected void | onRemoval(PoolThreadCache threadCache)
Overrides io. remove().
|
| useCacheForAllThreads | back to summary |
|---|---|
| private final boolean useCacheForAllThreads | |
| PoolThreadLocalCache | back to summary |
|---|---|
| pack-priv PoolThreadLocalCache(boolean useCacheForAllThreads) | |
| initialValue | back to summary |
|---|---|
| protected synchronized PoolThreadCache initialValue() Overrides io. Doc from io. Returns the initial value for this thread-local variable.
| |
| onRemoval | back to summary |
|---|---|
| protected void onRemoval(PoolThreadCache threadCache) Overrides io. Doc from io. Invoked when this thread local variable is removed by
| |