java.lang.Object
org.apache.arrow.adapter.orc.OrcReferenceManager
- All Implemented Interfaces:
ReferenceManager
A simple reference manager implementation for memory allocated by native code. The underlying
memory will be released when reference count reach zero.
-
Field Summary
Fields inherited from interface org.apache.arrow.memory.ReferenceManager
NO_OP, NO_OP_ERROR_MESSAGE -
Method Summary
Modifier and TypeMethodDescriptionderiveBuffer(ArrowBuf sourceBuffer, long index, long length) Derive a new ArrowBuf from a given source ArrowBuf.longGet the total accounted size (in bytes).Get the buffer allocator associated with this reference manager.intReturn the reference count.longgetSize()Total size (in bytes) of memory underlying this reference manager.booleanrelease()Decrement this reference manager's reference count by 1 for the associated underlying memory.booleanrelease(int decrement) Decrement this reference manager's reference count for the associated underlying memory.voidretain()Increment this reference manager's reference count by 1 for the associated underlying memory.voidretain(int increment) Increment this reference manager's reference count by a given amount for the associated underlying memory.retain(ArrowBuf srcBuffer, BufferAllocator targetAllocator) Create a new ArrowBuf that is associated with an alternative allocator for the purposes of memory ownership and accounting.transferOwnership(ArrowBuf sourceBuffer, BufferAllocator targetAllocator) Duplicate the memory accounting ownership of the backing allocation of the given ArrowBuf in another allocator.
-
Method Details
-
getRefCount
public int getRefCount()Description copied from interface:ReferenceManagerReturn the reference count.- Specified by:
getRefCountin interfaceReferenceManager- Returns:
- reference count
-
release
public boolean release()Description copied from interface:ReferenceManagerDecrement this reference manager's reference count by 1 for the associated underlying memory. If the reference count drops to 0, it implies that ArrowBufs managed by this reference manager no longer need access to the underlying memory- Specified by:
releasein interfaceReferenceManager- Returns:
- true if ref count has dropped to 0, false otherwise
-
release
public boolean release(int decrement) Description copied from interface:ReferenceManagerDecrement this reference manager's reference count for the associated underlying memory. If the reference count drops to 0, it implies that ArrowBufs managed by this reference manager no longer need access to the underlying memory- Specified by:
releasein interfaceReferenceManager- Parameters:
decrement- the count to decrease the reference count by- Returns:
- the new reference count
-
retain
public void retain()Description copied from interface:ReferenceManagerIncrement this reference manager's reference count by 1 for the associated underlying memory.- Specified by:
retainin interfaceReferenceManager
-
retain
public void retain(int increment) Description copied from interface:ReferenceManagerIncrement this reference manager's reference count by a given amount for the associated underlying memory.- Specified by:
retainin interfaceReferenceManager- Parameters:
increment- the count to increase the reference count by
-
retain
Description copied from interface:ReferenceManagerCreate a new ArrowBuf that is associated with an alternative allocator for the purposes of memory ownership and accounting. This has no impact on the reference counting for the current ArrowBuf except in the situation where the passed in Allocator is the same as the current buffer. This operation has no impact on the reference count of this ArrowBuf. The newly created ArrowBuf with either have a reference count of 1 (in the case that this is the first time this memory is being associated with the target allocator or in other words allocation manager currently doesn't hold a mapping for the target allocator) or the current value of the reference count for the target allocator-reference manager combination + 1 in the case that the provided allocator already had an association to this underlying memory.The underlying allocation (
AllocationManager) will not be copied.- Specified by:
retainin interfaceReferenceManager- Parameters:
srcBuffer- source ArrowBuftargetAllocator- The target allocator to create an association with.- Returns:
- A new ArrowBuf which shares the same underlying memory as this ArrowBuf.
-
deriveBuffer
Description copied from interface:ReferenceManagerDerive a new ArrowBuf from a given source ArrowBuf. The new derived ArrowBuf will share the same reference count as rest of the ArrowBufs associated with this reference manager.- Specified by:
deriveBufferin interfaceReferenceManager- Parameters:
sourceBuffer- source ArrowBufindex- index (relative to source ArrowBuf) new ArrowBuf should be derived fromlength- length (bytes) of data in underlying memory that derived buffer will have access to in underlying memory- Returns:
- derived buffer
-
transferOwnership
public OwnershipTransferResult transferOwnership(ArrowBuf sourceBuffer, BufferAllocator targetAllocator) Description copied from interface:ReferenceManagerDuplicate the memory accounting ownership of the backing allocation of the given ArrowBuf in another allocator. This will generate a new ArrowBuf that carries an association with the same underlying memory (AllocationManagers) as the given ArrowBuf.- Specified by:
transferOwnershipin interfaceReferenceManager- Parameters:
sourceBuffer- source ArrowBuftargetAllocator- The target allocator to create an association with- Returns:
OwnershipTransferResultwith info on transfer result and new buffer
-
getAllocator
Description copied from interface:ReferenceManagerGet the buffer allocator associated with this reference manager.- Specified by:
getAllocatorin interfaceReferenceManager- Returns:
- buffer allocator.
-
getSize
public long getSize()Description copied from interface:ReferenceManagerTotal size (in bytes) of memory underlying this reference manager.- Specified by:
getSizein interfaceReferenceManager- Returns:
- Size (in bytes) of the memory chunk.
-
getAccountedSize
public long getAccountedSize()Description copied from interface:ReferenceManagerGet the total accounted size (in bytes).- Specified by:
getAccountedSizein interfaceReferenceManager- Returns:
- accounted size.
-