public interface BufferAllocator extends AutoCloseable
Modifier and Type | Method and Description |
---|---|
void |
assertOpen()
Asserts (using java assertions) that the provided allocator is currently open.
|
ArrowBuf |
buffer(long size)
Allocate a new or reused buffer of the provided size.
|
ArrowBuf |
buffer(long size,
BufferManager manager)
Allocate a new or reused buffer of the provided size.
|
void |
close()
Close and release all buffers generated from this buffer pool.
|
long |
getAllocatedMemory()
Returns the amount of memory currently allocated from this allocator.
|
io.netty.buffer.ByteBufAllocator |
getAsByteBufAllocator()
Deprecated.
This method may be removed in a future release.
|
Collection<BufferAllocator> |
getChildAllocators()
Returns the set of child allocators.
|
ArrowBuf |
getEmpty()
Get a reference to the empty buffer associated with this allocator.
|
long |
getHeadroom()
Returns the amount of memory that can probably be allocated at this moment
without exceeding this or any parents allocation maximum.
|
long |
getInitReservation()
Return the initial reservation.
|
long |
getLimit()
Return the current maximum limit this allocator imposes.
|
String |
getName()
Return the name of this allocator.
|
BufferAllocator |
getParentAllocator()
Returns the parent allocator.
|
long |
getPeakMemoryAllocation()
Returns the peak amount of memory allocated from this allocator.
|
boolean |
isOverLimit()
Return whether or not this allocator (or one if its parents) is over its limits.
|
BufferAllocator |
newChildAllocator(String name,
AllocationListener listener,
long initReservation,
long maxAllocation)
Create a new child allocator.
|
BufferAllocator |
newChildAllocator(String name,
long initReservation,
long maxAllocation)
Create a new child allocator.
|
AllocationReservation |
newReservation()
Create an allocation reservation.
|
void |
setLimit(long newLimit)
Set the maximum amount of memory this allocator is allowed to allocate.
|
String |
toVerboseString()
Return a verbose string describing this allocator.
|
ArrowBuf buffer(long size)
size
- The size in bytes.OutOfMemoryException
- if buffer cannot be allocatedArrowBuf buffer(long size, BufferManager manager)
size
- The size in bytes.manager
- A buffer manager to manage reallocation.OutOfMemoryException
- if buffer cannot be allocated@Deprecated io.netty.buffer.ByteBufAllocator getAsByteBufAllocator()
BufferAllocator newChildAllocator(String name, long initReservation, long maxAllocation)
name
- the name of the allocator.initReservation
- the initial space reservation (obtained from this allocator)maxAllocation
- maximum amount of space the new allocator can allocateBufferAllocator newChildAllocator(String name, AllocationListener listener, long initReservation, long maxAllocation)
name
- the name of the allocator.listener
- allocation listener for the newly created childinitReservation
- the initial space reservation (obtained from this allocator)maxAllocation
- maximum amount of space the new allocator can allocatevoid close()
When assertions are on, complains if there are any outstanding buffers; to avoid that, release all buffers before the allocator is closed.
close
in interface AutoCloseable
long getAllocatedMemory()
long getLimit()
long getInitReservation()
void setLimit(long newLimit)
newLimit
- The new Limit to apply to allocationslong getPeakMemoryAllocation()
long getHeadroom()
BufferAllocator getParentAllocator()
Collection<BufferAllocator> getChildAllocators()
AllocationReservation newReservation()
AllocationReservation
ArrowBuf getEmpty()
String getName()
boolean isOverLimit()
String toVerboseString()
void assertOpen()
Copyright © 2020 The Apache Software Foundation. All rights reserved.