public abstract class BaseAllocator extends Object implements BufferAllocator
| Modifier and Type | Class and Description |
|---|---|
static class |
Accountant.AllocationOutcome
Describes the type of outcome that occurred when trying to account for allocation of memory.
|
class |
BaseAllocator.Reservation |
static class |
BaseAllocator.Verbosity |
| Modifier and Type | Field and Description |
|---|---|
static boolean |
DEBUG |
static String |
DEBUG_ALLOCATOR |
static int |
DEBUG_LOG_LENGTH |
protected org.apache.arrow.memory.Accountant |
parent
The parent allocator
|
protected long |
reservation
The amount of memory reserved for this allocator.
|
| Modifier | Constructor and Description |
|---|---|
protected |
BaseAllocator(AllocationListener listener,
String name,
long initReservation,
long maxAllocation) |
protected |
BaseAllocator(BaseAllocator parentAllocator,
String name,
long initReservation,
long maxAllocation) |
| Modifier and Type | Method and Description |
|---|---|
void |
assertOpen()
Asserts (using java assertions) that the provided allocator is currently open.
|
ArrowBuf |
buffer(int initialRequestSize)
Allocate a new or reused buffer of the provided size.
|
ArrowBuf |
buffer(int initialRequestSize,
BufferManager manager)
Allocate a new or reused buffer of the provided size.
|
void |
close()
Close this Accountant.
|
long |
getAllocatedMemory()
Return the current amount of allocated memory that this Accountant is managing accounting
for.
|
ArrowByteBufAllocator |
getAsByteBufAllocator()
Returns the allocator this allocator falls back to when it needs more memory.
|
ArrowBuf |
getEmpty()
Get a reference to the empty buffer associated with this allocator.
|
long |
getHeadroom() |
long |
getLimit()
Return the current limit of this Accountant.
|
String |
getName()
Return the name of this allocator.
|
long |
getPeakMemoryAllocation()
The peak memory allocated by this Accountant.
|
static StringBuilder |
indent(StringBuilder sb,
int indent) |
static boolean |
isDebug() |
boolean |
isOverLimit() |
BufferAllocator |
newChildAllocator(String name,
long initReservation,
long maxAllocation)
Create a new child allocator.
|
AllocationReservation |
newReservation()
Create an allocation reservation.
|
static int |
nextPowerOfTwo(int val)
Rounds up the provided value to the nearest power of two.
|
static long |
nextPowerOfTwo(long val)
Rounds up the provided value to the nearest power of two.
|
void |
releaseBytes(long size) |
void |
setLimit(long newLimit)
Set the maximum amount of memory that can be allocated in the this Accountant before failing
an allocation.
|
String |
toString() |
String |
toVerboseString()
Provide a verbose string of the current allocator state.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetAllocatedMemory, getHeadroom, getLimit, getPeakMemoryAllocation, isOverLimit, setLimitpublic static final String DEBUG_ALLOCATOR
public static final int DEBUG_LOG_LENGTH
public static final boolean DEBUG
protected final org.apache.arrow.memory.Accountant parent
protected final long reservation
protected BaseAllocator(AllocationListener listener, String name, long initReservation, long maxAllocation) throws OutOfMemoryException
OutOfMemoryExceptionprotected BaseAllocator(BaseAllocator parentAllocator, String name, long initReservation, long maxAllocation) throws OutOfMemoryException
OutOfMemoryExceptionpublic static int nextPowerOfTwo(int val)
val - An integer value.public static long nextPowerOfTwo(long val)
val - A long value.public static StringBuilder indent(StringBuilder sb, int indent)
public static boolean isDebug()
public void assertOpen()
BufferAllocatorassertOpen in interface BufferAllocatorpublic String getName()
BufferAllocatorgetName in interface BufferAllocatorpublic ArrowBuf getEmpty()
BufferAllocatorgetEmpty in interface BufferAllocatorpublic ArrowBuf buffer(int initialRequestSize)
BufferAllocatorbuffer in interface BufferAllocatorinitialRequestSize - The size in bytes.public ArrowBuf buffer(int initialRequestSize, BufferManager manager)
BufferAllocatorbuffer in interface BufferAllocatorinitialRequestSize - The size in bytes.manager - A buffer manager to manage reallocation.public ArrowByteBufAllocator getAsByteBufAllocator()
BufferAllocatorgetAsByteBufAllocator in interface BufferAllocatorpublic BufferAllocator newChildAllocator(String name, long initReservation, long maxAllocation)
BufferAllocatornewChildAllocator in interface BufferAllocatorname - the name of the allocator.initReservation - the initial space reservation (obtained from this allocator)maxAllocation - maximum amount of space the new allocator can allocatepublic AllocationReservation newReservation()
BufferAllocatornewReservation in interface BufferAllocatorAllocationReservationpublic void close()
close in interface AutoCloseableclose in interface BufferAllocatorpublic String toVerboseString()
toVerboseString in interface BufferAllocatorpublic void releaseBytes(long size)
public boolean isOverLimit()
public long getLimit()
public void setLimit(long newLimit)
newLimit - The limit in bytes.public long getAllocatedMemory()
public long getPeakMemoryAllocation()
public long getHeadroom()
Copyright © 2017 The Apache Software Foundation. All rights reserved.