Package one.nio.mem

Class FixedSizeAllocator

java.lang.Object
one.nio.mem.FixedSizeAllocator
All Implemented Interfaces:
Allocator

public class FixedSizeAllocator extends Object implements Allocator
  • Field Details

    • headOffset

      protected static final long headOffset
    • 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 Details

    • 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 Details

    • 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()
    • malloc

      public long malloc(int size)
      Specified by:
      malloc in interface Allocator
    • calloc

      public long calloc(int size)
      Specified by:
      calloc in interface Allocator
    • free

      public void free(long entry)
      Specified by:
      free in interface Allocator
    • verify

      public void verify()
      Description copied from interface: Allocator
      Verify the layout of the heap. Expensive operation, used only for debugging purposes.
      Specified by:
      verify in interface Allocator
    • getMemoryFromSystem

      protected long getMemoryFromSystem(long size)
    • usedPages

      public long usedPages()
    • totalPages

      public long totalPages()
    • freePages

      public long freePages()
    • usedMemory

      public long usedMemory()