Class AllocationManager

java.lang.Object
org.apache.arrow.memory.AllocationManager
Direct Known Subclasses:
NettyAllocationManager, UnsafeAllocationManager

public abstract class AllocationManager extends Object
An AllocationManager is the implementation of a physical memory allocation.

Manages the relationship between the allocators and a particular memory allocation. Ensures that one allocator owns the memory that multiple allocators may be referencing. Manages a BufferLedger between each of its associated allocators. It does not track the reference count; that is the role of BufferLedger (aka ReferenceManager).

This is a public interface implemented by concrete allocator implementations (e.g. Netty or Unsafe).

Threading: AllocationManager manages thread-safety internally. Operations within the context of a single BufferLedger are lockless in nature and can be leveraged by multiple threads. Operations that cross the context of two ledgers will acquire a lock on the AllocationManager instance. Important note, there is one AllocationManager per physical buffer allocation. As such, there will be thousands of these in a typical query. The contention of acquiring a lock on AllocationManager should be very low.

  • Constructor Details

    • AllocationManager

      protected AllocationManager(BufferAllocator accountingAllocator)
  • Method Details

    • getSize

      public abstract long getSize()
      Return the size of underlying chunk of memory managed by this Allocation Manager.

      The underlying memory chunk managed can be different from the original requested size.

      Returns:
      size of underlying memory chunk
    • memoryAddress

      protected abstract long memoryAddress()
      Return the absolute memory address pointing to the fist byte of underlying memory chunk.
    • release0

      protected abstract void release0()
      Release the underlying memory chunk.