Package one.nio.mem

Class MallocMT

  • All Implemented Interfaces:
    Allocator, MallocMXBean
    Direct Known Subclasses:
    MallocAnalyzer

    public class MallocMT
    extends Malloc
    Concurrent implementation of Malloc. Divides the whole memory space into several synchronized Malloc-segments to reduce lock contention.
    Author:
    Vadim Tsesko
    • Field Detail

      • DEFAULT_CONCURRENCY_LEVEL

        public static final int DEFAULT_CONCURRENCY_LEVEL
        See Also:
        Constant Field Values
    • Constructor Detail

      • 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

        public MallocMT​(MappedFile mmap,
                        int concurrencyLevel)
    • Method Detail

      • segments

        public int segments()
      • segment

        public Malloc segment​(int index)
      • segmentFor

        public Malloc segmentFor​(long n)
        Deterministically get one of the segments by some long value
      • free

        public void free​(long address)
        Specified by:
        free in interface Allocator
        Overrides:
        free in class Malloc
      • allocatedSize

        public int allocatedSize​(long address)
        Overrides:
        allocatedSize in class Malloc
      • 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
        Overrides:
        verify in class Malloc