Package one.nio.mem

Class FixedSizeAllocator

  • All Implemented Interfaces:
    Allocator

    public class FixedSizeAllocator
    extends java.lang.Object
    implements Allocator
    • Field Detail

      • headOffset

        protected static final long headOffset
      • p1

        private volatile long p1
      • p2

        private volatile long p2
      • p3

        private volatile long p3
      • p4

        private volatile long p4
      • p5

        private volatile long p5
      • p6

        private volatile long p6
      • p7

        private volatile long p7
      • head

        protected volatile long head
      • q1

        private volatile long q1
      • q2

        private volatile long q2
      • q3

        private volatile long q3
      • q4

        private volatile long q4
      • q5

        private volatile long q5
      • q6

        private volatile long q6
      • q7

        private volatile long q7
      • usedPages

        protected java.util.concurrent.atomic.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()
      • 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
      • requestMoreMemory

        private void requestMoreMemory()
      • getMemoryFromSystem

        protected long getMemoryFromSystem​(long size)
      • usedPages

        public long usedPages()
      • totalPages

        public long totalPages()
      • freePages

        public long freePages()
      • usedMemory

        public long usedMemory()