Package one.nio.mem
Class FixedSizeAllocator
- java.lang.Object
-
- one.nio.mem.FixedSizeAllocator
-
-
Field Summary
Fields Modifier and Type Field Description protected longchunkSizeprotected longentrySizeprotected longheadprotected static longheadOffsetprotected longstartAddressprotected longtotalMemoryprotected longtotalPagesprotected AtomicLongusedPages
-
Constructor Summary
Constructors Constructor Description FixedSizeAllocator(long entrySize, long chunkSize)FixedSizeAllocator(long startAddress, long totalMemory, long entrySize)FixedSizeAllocator(long startAddress, long totalMemory, long entrySize, long head)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description longcalloc(int size)longchunkSize()protected intcountFreePages()longentrySize()voidfree(long entry)longfreePages()protected longgetMemoryFromSystem(long size)longhead()longmalloc()longmalloc(int size)static voidrelocate(long currentPtr, long delta)longstartAddress()longtotalMemory()longtotalPages()longusedMemory()longusedPages()voidverify()Verify the layout of the heap.
-
-
-
Field Detail
-
headOffset
protected static final long headOffset
-
head
protected volatile long head
-
usedPages
protected AtomicLong usedPages
-
startAddress
protected final long startAddress
-
entrySize
protected final long entrySize
-
chunkSize
protected final long chunkSize
-
totalMemory
protected long totalMemory
-
totalPages
protected long totalPages
-
-
Constructor Detail
-
FixedSizeAllocator
public FixedSizeAllocator(long entrySize, long chunkSize)
-
FixedSizeAllocator
public FixedSizeAllocator(long startAddress, long totalMemory, long entrySize)
-
FixedSizeAllocator
public FixedSizeAllocator(long startAddress, long totalMemory, long entrySize, long head)
-
-
Method Detail
-
relocate
public static void relocate(long currentPtr, long delta)
-
head
public long head()
-
countFreePages
protected int countFreePages()
-
entrySize
public long entrySize()
-
chunkSize
public long chunkSize()
-
startAddress
public long startAddress()
-
totalMemory
public long totalMemory()
-
malloc
public long malloc()
-
verify
public void verify()
Description copied from interface:AllocatorVerify the layout of the heap. Expensive operation, used only for debugging purposes.
-
getMemoryFromSystem
protected long getMemoryFromSystem(long size)
-
usedPages
public long usedPages()
-
totalPages
public long totalPages()
-
freePages
public long freePages()
-
usedMemory
public long usedMemory()
-
-