Class UnpooledOffHeapMemoryAllocator

    • Constructor Detail

      • UnpooledOffHeapMemoryAllocator

        public UnpooledOffHeapMemoryAllocator()
    • Method Detail

      • allocate

        public long allocate​(long memoryLength)
        Description copied from interface: OffHeapMemoryAllocator
        Allocates a new chunk of memory sized to the given length.
        Specified by:
        allocate in interface OffHeapMemoryAllocator
        memoryLength - the size of memory to allocate
        the memory address where the memory resides
      • deallocate

        public void deallocate​(long memoryAddress,
                               long size)
        Description copied from interface: OffHeapMemoryAllocator
        Deallocates the memory at the given address assuming a given size. This size is the size that was provided to allocate.
        Specified by:
        deallocate in interface OffHeapMemoryAllocator
        memoryAddress - the address to deallocate from
        size - the total size
      • estimateSizeOverhead

        public static long estimateSizeOverhead​(long size)
        Tries to estimate overhead of the allocation by first adding 8 to account for underlying allocator housekeeping and then rounds up to nearest power of 16 to account for 16 byte alignment.
        size - the desired size of the allocation
        the resulting size taking into account various overheads