Class DirectByteBufferPoolReal

java.lang.Object
com.biglybt.core.util.DirectByteBufferPool
com.biglybt.core.util.DirectByteBufferPoolReal

public class DirectByteBufferPoolReal extends DirectByteBufferPool
  • Field Details

    • disable_gc

      private static final boolean disable_gc
    • DEBUG_TRACK_HANDEDOUT

      protected static final boolean DEBUG_TRACK_HANDEDOUT
      See Also:
    • DEBUG_PRINT_MEM

      protected static final boolean DEBUG_PRINT_MEM
      See Also:
    • DEBUG_PRINT_TIME

      protected static final int DEBUG_PRINT_TIME
      See Also:
    • DEBUG_HANDOUT_SIZES

      protected static final boolean DEBUG_HANDOUT_SIZES
      See Also:
    • DEBUG_FREE_SIZES

      protected static final boolean DEBUG_FREE_SIZES
      See Also:
    • START_POWER

      private static final int START_POWER
      See Also:
    • END_POWER

      private static final int END_POWER
      See Also:
    • EXTRA_BUCKETS

      private static final int[] EXTRA_BUCKETS
    • MAX_SIZE

      public static final int MAX_SIZE
    • buffersMap

      private final Map buffersMap
    • poolsLock

      private final Object poolsLock
    • SLICE_END_SIZE

      private static final int SLICE_END_SIZE
      See Also:
    • SLICE_ALLOC_CHUNK_SIZE

      private static final int SLICE_ALLOC_CHUNK_SIZE
      See Also:
    • SLICE_ENTRY_SIZES

      private static final short[] SLICE_ENTRY_SIZES
    • SLICE_ALLOC_MAXS

      private static final short[] SLICE_ALLOC_MAXS
    • SLICE_ENTRY_ALLOC_SIZES

      private static final short[] SLICE_ENTRY_ALLOC_SIZES
    • slice_entries

      private static final List[] slice_entries
    • slice_allocs

      private static final boolean[][] slice_allocs
    • slice_alloc_fails

      private static final boolean[] slice_alloc_fails
    • slice_use_count

      private static final long[] slice_use_count
    • handed_out

      private final Map handed_out
    • size_counts

      private final Map size_counts
    • COMPACTION_CHECK_PERIOD

      private static final long COMPACTION_CHECK_PERIOD
      See Also:
    • MAX_FREE_BYTES

      private static final long MAX_FREE_BYTES
      See Also:
    • MIN_FREE_BYTES

      private static final long MIN_FREE_BYTES
      See Also:
    • bytesIn

      private long bytesIn
    • bytesOut

      private long bytesOut
  • Constructor Details

    • DirectByteBufferPoolReal

      protected DirectByteBufferPoolReal()
  • Method Details

    • allocateNewBuffer

      private ByteBuffer allocateNewBuffer(int _size)
      Allocate and return a new direct ByteBuffer.
    • getBufferSupport

      protected DirectByteBuffer getBufferSupport(byte _allocator, int _length)
      Retrieve a buffer from the buffer pool of size at least length, and no larger than DirectByteBufferPool.MAX_SIZE
      Specified by:
      getBufferSupport in class DirectByteBufferPool
    • getBufferHelper

      private DirectByteBuffer getBufferHelper(byte _allocator, int _length)
      Retrieve an appropriate buffer from the free pool, or create a new one if the pool is empty.
    • returnBufferSupport

      protected void returnBufferSupport(DirectByteBuffer ddb)
      Return the given buffer to the appropriate pool.
      Specified by:
      returnBufferSupport in class DirectByteBufferPool
    • clearBufferPools

      private void clearBufferPools()
      Clears the free buffer pools so that currently unused buffers can be garbage collected.
    • runGarbageCollection

      private void runGarbageCollection()
      Force system garbage collection.
    • compactBuffers

      private void compactBuffers()
      Checks memory usage of free buffers in buffer pools, and calls the compaction method if necessary.
    • bytesFree

      private long bytesFree()
    • printInUse

      private void printInUse(boolean verbose)
    • getSliceBuffer

      private DirectByteBuffer getSliceBuffer(byte _allocator, int _length)
    • freeSliceBuffer

      private void freeSliceBuffer(DirectByteBuffer ddb)
    • compactSlices

      private void compactSlices()
    • getSliceIndex

      private int getSliceIndex(int _length)