Package org.apache.arrow.memory
Class DatabricksBufferAllocator
- java.lang.Object
-
- org.apache.arrow.memory.DatabricksBufferAllocator
-
- All Implemented Interfaces:
AutoCloseable,org.apache.arrow.memory.BufferAllocator
public class DatabricksBufferAllocator extends Object implements org.apache.arrow.memory.BufferAllocator
A BufferAllocator implementation that uses DatabricksArrowBuf for memory allocation. This allocator uses heap-based ByteBuffer storage instead of direct/off-heap memory, avoiding the need for sun.misc.Unsafe operations.This implementation is suitable for environments where direct memory access is restricted or where heap-based memory management is preferred.
-
-
Constructor Summary
Constructors Constructor Description DatabricksBufferAllocator()Creates a root allocator with default settings.DatabricksBufferAllocator(String name)Creates a root allocator with specified limit.DatabricksBufferAllocator(String name, DatabricksBufferAllocator parent)Creates an allocator with full configuration.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidassertOpen()ArrowBufbuffer(long size)ArrowBufbuffer(long size, org.apache.arrow.memory.BufferManager manager)voidclose()booleanforceAllocate(long size)longgetAllocatedMemory()Collection<org.apache.arrow.memory.BufferAllocator>getChildAllocators()ArrowBufgetEmpty()longgetHeadroom()longgetInitReservation()longgetLimit()org.apache.arrow.memory.AllocationListenergetListener()StringgetName()org.apache.arrow.memory.BufferAllocatorgetParentAllocator()longgetPeakMemoryAllocation()org.apache.arrow.memory.BufferAllocatorgetRoot()org.apache.arrow.memory.rounding.RoundingPolicygetRoundingPolicy()booleanisOverLimit()org.apache.arrow.memory.BufferAllocatornewChildAllocator(String name, long initReservation, long maxAllocation)org.apache.arrow.memory.BufferAllocatornewChildAllocator(String name, org.apache.arrow.memory.AllocationListener listener, long initReservation, long maxAllocation)org.apache.arrow.memory.AllocationReservationnewReservation()voidreleaseBytes(long size)voidsetLimit(long newLimit)StringtoVerboseString()ArrowBufwrapForeignAllocation(org.apache.arrow.memory.ForeignAllocation allocation)
-
-
-
Constructor Detail
-
DatabricksBufferAllocator
public DatabricksBufferAllocator()
Creates a root allocator with default settings.
-
DatabricksBufferAllocator
public DatabricksBufferAllocator(String name)
Creates a root allocator with specified limit.- Parameters:
name- the allocator name
-
DatabricksBufferAllocator
public DatabricksBufferAllocator(String name, DatabricksBufferAllocator parent)
Creates an allocator with full configuration.- Parameters:
name- the allocator nameparent- the parent allocator (null for root)
-
-
Method Detail
-
buffer
public ArrowBuf buffer(long size)
- Specified by:
bufferin interfaceorg.apache.arrow.memory.BufferAllocator
-
buffer
public ArrowBuf buffer(long size, org.apache.arrow.memory.BufferManager manager)
- Specified by:
bufferin interfaceorg.apache.arrow.memory.BufferAllocator
-
getRoot
public org.apache.arrow.memory.BufferAllocator getRoot()
- Specified by:
getRootin interfaceorg.apache.arrow.memory.BufferAllocator
-
newChildAllocator
public org.apache.arrow.memory.BufferAllocator newChildAllocator(String name, long initReservation, long maxAllocation)
- Specified by:
newChildAllocatorin interfaceorg.apache.arrow.memory.BufferAllocator
-
newChildAllocator
public org.apache.arrow.memory.BufferAllocator newChildAllocator(String name, org.apache.arrow.memory.AllocationListener listener, long initReservation, long maxAllocation)
- Specified by:
newChildAllocatorin interfaceorg.apache.arrow.memory.BufferAllocator
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceorg.apache.arrow.memory.BufferAllocator
-
getAllocatedMemory
public long getAllocatedMemory()
- Specified by:
getAllocatedMemoryin interfaceorg.apache.arrow.memory.BufferAllocator
-
getLimit
public long getLimit()
- Specified by:
getLimitin interfaceorg.apache.arrow.memory.BufferAllocator
-
getInitReservation
public long getInitReservation()
- Specified by:
getInitReservationin interfaceorg.apache.arrow.memory.BufferAllocator
-
setLimit
public void setLimit(long newLimit)
- Specified by:
setLimitin interfaceorg.apache.arrow.memory.BufferAllocator
-
getPeakMemoryAllocation
public long getPeakMemoryAllocation()
- Specified by:
getPeakMemoryAllocationin interfaceorg.apache.arrow.memory.BufferAllocator
-
getHeadroom
public long getHeadroom()
- Specified by:
getHeadroomin interfaceorg.apache.arrow.memory.BufferAllocator
-
forceAllocate
public boolean forceAllocate(long size)
- Specified by:
forceAllocatein interfaceorg.apache.arrow.memory.BufferAllocator
-
releaseBytes
public void releaseBytes(long size)
- Specified by:
releaseBytesin interfaceorg.apache.arrow.memory.BufferAllocator
-
getListener
public org.apache.arrow.memory.AllocationListener getListener()
- Specified by:
getListenerin interfaceorg.apache.arrow.memory.BufferAllocator
-
getParentAllocator
public org.apache.arrow.memory.BufferAllocator getParentAllocator()
- Specified by:
getParentAllocatorin interfaceorg.apache.arrow.memory.BufferAllocator
-
getChildAllocators
public Collection<org.apache.arrow.memory.BufferAllocator> getChildAllocators()
- Specified by:
getChildAllocatorsin interfaceorg.apache.arrow.memory.BufferAllocator
-
newReservation
public org.apache.arrow.memory.AllocationReservation newReservation()
- Specified by:
newReservationin interfaceorg.apache.arrow.memory.BufferAllocator
-
getEmpty
public ArrowBuf getEmpty()
- Specified by:
getEmptyin interfaceorg.apache.arrow.memory.BufferAllocator
-
getName
public String getName()
- Specified by:
getNamein interfaceorg.apache.arrow.memory.BufferAllocator
-
isOverLimit
public boolean isOverLimit()
- Specified by:
isOverLimitin interfaceorg.apache.arrow.memory.BufferAllocator
-
toVerboseString
public String toVerboseString()
- Specified by:
toVerboseStringin interfaceorg.apache.arrow.memory.BufferAllocator
-
assertOpen
public void assertOpen()
- Specified by:
assertOpenin interfaceorg.apache.arrow.memory.BufferAllocator
-
getRoundingPolicy
public org.apache.arrow.memory.rounding.RoundingPolicy getRoundingPolicy()
- Specified by:
getRoundingPolicyin interfaceorg.apache.arrow.memory.BufferAllocator
-
wrapForeignAllocation
public ArrowBuf wrapForeignAllocation(org.apache.arrow.memory.ForeignAllocation allocation)
- Specified by:
wrapForeignAllocationin interfaceorg.apache.arrow.memory.BufferAllocator
-
-