public abstract class AllocationManager extends Object
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.
Modifier and Type | Class and Description |
---|---|
static interface |
AllocationManager.Factory
A factory interface for creating
AllocationManager . |
Modifier | Constructor and Description |
---|---|
protected |
AllocationManager(BufferAllocator accountingAllocator) |
Modifier and Type | Method and Description |
---|---|
abstract long |
getSize()
Return the size of underlying chunk of memory managed by this Allocation Manager.
|
protected abstract long |
memoryAddress()
Return the absolute memory address pointing to the fist byte of underlying memory chunk.
|
protected abstract void |
release0()
Release the underlying memory chunk.
|
protected AllocationManager(BufferAllocator accountingAllocator)
public abstract long getSize()
The underlying memory chunk managed can be different from the original requested size.
protected abstract long memoryAddress()
protected abstract void release0()
Copyright © 2023 The Apache Software Foundation. All rights reserved.