Package com.biglybt.core.util
Class DirectByteBufferPoolReal
java.lang.Object
com.biglybt.core.util.DirectByteBufferPool
com.biglybt.core.util.DirectByteBufferPoolReal
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
private static class
private static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map
private long
private long
private static final long
protected static final boolean
protected static final boolean
protected static final boolean
protected static final int
protected static final boolean
private static final boolean
private static final int
private static final int[]
private final Map
private static final long
static final int
private static final long
private final Object
private final Map
private static final int
private static final boolean[]
private static final short[]
private static final boolean[][]
private static final int
private static final List[]
private static final short[]
private static final short[]
private static final long[]
private static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate ByteBuffer
allocateNewBuffer
(int _size) Allocate and return a new direct ByteBuffer.private long
private void
Clears the free buffer pools so that currently unused buffers can be garbage collected.private void
Checks memory usage of free buffers in buffer pools, and calls the compaction method if necessary.private void
private void
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.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_SIZEprivate DirectByteBuffer
getSliceBuffer
(byte _allocator, int _length) private int
getSliceIndex
(int _length) private void
printInUse
(boolean verbose) protected void
Return the given buffer to the appropriate pool.private void
Force system garbage collection.Methods inherited from class com.biglybt.core.util.DirectByteBufferPool
getBuffer
-
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
-
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
-
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
-
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
Allocate and return a new direct ByteBuffer. -
getBufferSupport
Retrieve a buffer from the buffer pool of size at least length, and no larger than DirectByteBufferPool.MAX_SIZE- Specified by:
getBufferSupport
in classDirectByteBufferPool
-
getBufferHelper
Retrieve an appropriate buffer from the free pool, or create a new one if the pool is empty. -
returnBufferSupport
Return the given buffer to the appropriate pool.- Specified by:
returnBufferSupport
in classDirectByteBufferPool
-
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
-
freeSliceBuffer
-
compactSlices
private void compactSlices() -
getSliceIndex
private int getSliceIndex(int _length)
-