Class PooledByteBufAllocator

    • Constructor Detail

      • PooledByteBufAllocator

        public PooledByteBufAllocator()
      • PooledByteBufAllocator

        public PooledByteBufAllocator​(boolean preferDirect)
      • PooledByteBufAllocator

        public PooledByteBufAllocator​(int nHeapArena,
                                      int nDirectArena,
                                      int pageSize,
                                      int maxOrder)
      • PooledByteBufAllocator

        public PooledByteBufAllocator​(boolean preferDirect,
                                      int nHeapArena,
                                      int nDirectArena,
                                      int pageSize,
                                      int maxOrder,
                                      int smallCacheSize,
                                      int normalCacheSize,
                                      boolean useCacheForAllThreads)
      • PooledByteBufAllocator

        @Deprecated
        public PooledByteBufAllocator​(boolean preferDirect,
                                      int nHeapArena,
                                      int nDirectArena,
                                      int pageSize,
                                      int maxOrder,
                                      int tinyCacheSize,
                                      int smallCacheSize,
                                      int normalCacheSize,
                                      boolean useCacheForAllThreads,
                                      int directMemoryCacheAlignment)
      • PooledByteBufAllocator

        public PooledByteBufAllocator​(boolean preferDirect,
                                      int nHeapArena,
                                      int nDirectArena,
                                      int pageSize,
                                      int maxOrder,
                                      int smallCacheSize,
                                      int normalCacheSize,
                                      boolean useCacheForAllThreads,
                                      int directMemoryCacheAlignment)
    • Method Detail

      • defaultNumHeapArena

        public static int defaultNumHeapArena()
        Default number of heap arenas - System Property: io.netty.allocator.numHeapArenas - default 2 * cores
      • defaultNumDirectArena

        public static int defaultNumDirectArena()
        Default number of direct arenas - System Property: io.netty.allocator.numDirectArenas - default 2 * cores
      • defaultPageSize

        public static int defaultPageSize()
        Default buffer page size - System Property: io.netty.allocator.pageSize - default 8192
      • defaultMaxOrder

        public static int defaultMaxOrder()
        Default maximum order - System Property: io.netty.allocator.maxOrder - default 9
      • defaultDisableCacheFinalizersForFastThreadLocalThreads

        public static boolean defaultDisableCacheFinalizersForFastThreadLocalThreads()
        Default control creation of PoolThreadCache finalizers for FastThreadLocalThreads - System Property: io.netty.allocator.disableCacheFinalizersForFastThreadLocalThreads - default false
      • defaultUseCacheForAllThreads

        public static boolean defaultUseCacheForAllThreads()
        Default thread caching behavior - System Property: io.netty.allocator.useCacheForAllThreads - default false
      • defaultPreferDirect

        public static boolean defaultPreferDirect()
        Default prefer direct - System Property: io.netty.noPreferDirect - default false
      • defaultTinyCacheSize

        @Deprecated
        public static int defaultTinyCacheSize()
        Deprecated.
        Tiny caches have been merged into small caches.
        Default tiny cache size - default 0
      • defaultSmallCacheSize

        public static int defaultSmallCacheSize()
        Default small cache size - System Property: io.netty.allocator.smallCacheSize - default 256
      • defaultNormalCacheSize

        public static int defaultNormalCacheSize()
        Default normal cache size - System Property: io.netty.allocator.normalCacheSize - default 64
      • isDirectMemoryCacheAlignmentSupported

        public static boolean isDirectMemoryCacheAlignmentSupported()
        Return true if direct memory cache alignment is supported, false otherwise.
      • hasThreadLocalCache

        @Deprecated
        public boolean hasThreadLocalCache()
        Deprecated.
        will be removed Returns true if the calling Thread has a ThreadLocal cache for the allocated buffers.
      • freeThreadLocalCache

        @Deprecated
        public void freeThreadLocalCache()
        Deprecated.
        will be removed Free all cached buffers for the calling Thread.
      • pinnedHeapMemory

        public final long pinnedHeapMemory()
        Returns the number of bytes of heap memory that is currently pinned to heap buffers allocated by a ByteBufAllocator, or -1 if unknown. A buffer can pin more memory than its capacity might indicate, due to implementation details of the allocator.
      • pinnedDirectMemory

        public final long pinnedDirectMemory()
        Returns the number of bytes of direct memory that is currently pinned to direct buffers allocated by a ByteBufAllocator, or -1 if unknown. A buffer can pin more memory than its capacity might indicate, due to implementation details of the allocator.
      • trimCurrentThreadCache

        public boolean trimCurrentThreadCache()
        Trim thread local cache for the current Thread, which will give back any cached memory that was not allocated frequently since the last trim operation. Returns true if a cache for the current Thread exists and so was trimmed, false otherwise.
      • dumpStats

        public java.lang.String dumpStats()
        Returns the status of the allocator (which contains all metrics) as string. Be aware this may be expensive and so should not called too frequently.