Apache Arrow (C++)
A columnar in-memory analytics layer designed to accelerate big data.
Public Member Functions | Protected Member Functions | List of all members
arrow::MemoryPool Class Referenceabstract

Base class for memory allocation. More...

#include <arrow/memory_pool.h>

Inheritance diagram for arrow::MemoryPool:
arrow::LoggingMemoryPool

Public Member Functions

virtual ~MemoryPool ()
 
virtual Status Allocate (int64_t size, uint8_t **out)=0
 Allocate a new memory region of at least size bytes. More...
 
virtual Status Reallocate (int64_t old_size, int64_t new_size, uint8_t **ptr)=0
 Resize an already allocated memory section. More...
 
virtual void Free (uint8_t *buffer, int64_t size)=0
 Free an allocated region. More...
 
virtual int64_t bytes_allocated () const =0
 The number of bytes that were allocated and not yet free'd through this allocator. More...
 
virtual int64_t max_memory () const
 Return peak memory allocation in this memory pool. More...
 

Protected Member Functions

 MemoryPool ()
 

Detailed Description

Base class for memory allocation.

Besides tracking the number of allocated bytes, the allocator also should take care of the required 64-byte alignment.

Constructor & Destructor Documentation

◆ ~MemoryPool()

virtual arrow::MemoryPool::~MemoryPool ( )
virtual

◆ MemoryPool()

arrow::MemoryPool::MemoryPool ( )
protected

Member Function Documentation

◆ Allocate()

virtual Status arrow::MemoryPool::Allocate ( int64_t  size,
uint8_t **  out 
)
pure virtual

Allocate a new memory region of at least size bytes.

The allocated region shall be 64-byte aligned.

Implemented in arrow::LoggingMemoryPool.

◆ bytes_allocated()

virtual int64_t arrow::MemoryPool::bytes_allocated ( ) const
pure virtual

The number of bytes that were allocated and not yet free'd through this allocator.

Implemented in arrow::LoggingMemoryPool.

◆ Free()

virtual void arrow::MemoryPool::Free ( uint8_t *  buffer,
int64_t  size 
)
pure virtual

Free an allocated region.

Parameters
bufferPointer to the start of the allocated memory region
sizeAllocated size located at buffer. An allocator implementation may use this for tracking the amount of allocated bytes as well as for faster deallocation if supported by its backend.

Implemented in arrow::LoggingMemoryPool.

◆ max_memory()

virtual int64_t arrow::MemoryPool::max_memory ( ) const
virtual

Return peak memory allocation in this memory pool.

Returns
Maximum bytes allocated. If not known (or not implemented), returns -1

Reimplemented in arrow::LoggingMemoryPool.

◆ Reallocate()

virtual Status arrow::MemoryPool::Reallocate ( int64_t  old_size,
int64_t  new_size,
uint8_t **  ptr 
)
pure virtual

Resize an already allocated memory section.

As by default most default allocators on a platform don't support aligned reallocation, this function can involve a copy of the underlying data.

Implemented in arrow::LoggingMemoryPool.


The documentation for this class was generated from the following file: