Class DirectByteBufferPoolReal
java.lang.Object
com.biglybt.core.util.DirectByteBufferPool
com.biglybt.core.util.DirectByteBufferPoolReal
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classprivate static classprivate static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Mapprivate longprivate longprivate static final longprotected static final booleanprotected static final booleanprotected static final booleanprotected static final intprotected static final booleanprivate static final booleanprivate static final intprivate static final int[]private final Mapprivate static final longstatic final intprivate static final longprivate final Objectprivate final Mapprivate static final intprivate static final boolean[]private static final short[]private static final boolean[][]private static final intprivate 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 ByteBufferallocateNewBuffer(int _size) Allocate and return a new direct ByteBuffer.private longprivate voidClears the free buffer pools so that currently unused buffers can be garbage collected.private voidChecks memory usage of free buffers in buffer pools, and calls the compaction method if necessary.private voidprivate voidprivate DirectByteBuffergetBufferHelper(byte _allocator, int _length) Retrieve an appropriate buffer from the free pool, or create a new one if the pool is empty.protected DirectByteBuffergetBufferSupport(byte _allocator, int _length) Retrieve a buffer from the buffer pool of size at least length, and no larger than DirectByteBufferPool.MAX_SIZEprivate DirectByteBuffergetSliceBuffer(byte _allocator, int _length) private intgetSliceIndex(int _length) private voidprintInUse(boolean verbose) protected voidReturn the given buffer to the appropriate pool.private voidForce system garbage collection.Methods inherited from class 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:
getBufferSupportin 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:
returnBufferSupportin 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)
-