Package one.nio.mem
Class MallocMT
java.lang.Object
one.nio.mem.Malloc
one.nio.mem.MallocMT
- All Implemented Interfaces:
Allocator,MallocMXBean
- Direct Known Subclasses:
MallocAnalyzer
-
Field Summary
FieldsFields inherited from class one.nio.mem.Malloc
base, BASE_OFFSET, BIN_COUNT, BIN_SIZE, BIN_SPACE, capacity, CAPACITY_OFFSET, FREE_MASK, HEADER_SIZE, LEFT_OFFSET, MAX_CHUNK, MIN_CHUNK, NEXT_OFFSET, OCCUPIED_MASK, PREV_OFFSET, SIGNATURE_OFFSET, SIGNATURE_V2, SIGNATURE_V3, SIZE_OFFSET -
Constructor Summary
ConstructorsConstructorDescriptionMallocMT(long capacity) MallocMT(long capacity, int concurrencyLevel) MallocMT(long base, long capacity) MallocMT(long base, long capacity, int concurrencyLevel) MallocMT(MappedFile mmap) MallocMT(MappedFile mmap, int concurrencyLevel) -
Method Summary
Modifier and TypeMethodDescriptionintallocatedSize(long address) voidfree(long address) long(package private) voidinit()private voidinitSegments(int concurrencyLevel) longmalloc(int size) segment(int index) private MallocsegmentByAddress(long address) segmentFor(long n) Deterministically get one of the segments by somelongvalueintsegments()voidverify()Verify the layout of the heap.Methods inherited from class one.nio.mem.Malloc
base, binSize, calloc, chooseBin, getBin, getTotalMemory, getUsedMemory, mallocImpl
-
Field Details
-
DEFAULT_CONCURRENCY_LEVEL
public static final int DEFAULT_CONCURRENCY_LEVEL- See Also:
-
segments
-
segmentSize
private long segmentSize
-
-
Constructor Details
-
MallocMT
public MallocMT(long capacity, int concurrencyLevel) -
MallocMT
public MallocMT(long capacity) -
MallocMT
public MallocMT(long base, long capacity, int concurrencyLevel) -
MallocMT
public MallocMT(long base, long capacity) -
MallocMT
-
MallocMT
-
-
Method Details
-
segments
public int segments() -
segment
-
segmentFor
Deterministically get one of the segments by somelongvalue- Parameters:
n- an index of the segment to return- Returns:
- the
Mallocinstance for the specified segment
-
getFreeMemory
public long getFreeMemory()- Specified by:
getFreeMemoryin interfaceMallocMXBean- Overrides:
getFreeMemoryin classMalloc
-
malloc
public long malloc(int size) -
segmentByAddress
-
free
public void free(long address) -
allocatedSize
public int allocatedSize(long address) - Overrides:
allocatedSizein classMalloc
-
verify
public void verify()Description copied from interface:AllocatorVerify the layout of the heap. Expensive operation, used only for debugging purposes. -
init
void init() -
initSegments
private void initSegments(int concurrencyLevel)
-