pyarrow.MemoryPool

class pyarrow.MemoryPool

Bases: _Weakrefable

Base class for memory allocation.

Besides tracking its number of allocated bytes, a memory pool also takes care of the required 64-byte alignment for Arrow data.

__init__(*args, **kwargs)

Methods

__init__(*args, **kwargs)

bytes_allocated(self)

Return the number of bytes that are currently allocated from this memory pool.

max_memory(self)

Return the peak memory allocation in this memory pool.

release_unused(self)

Attempt to return to the OS any memory being held onto by the pool.

Attributes

backend_name

The name of the backend used by this MemoryPool (e.g.

backend_name

The name of the backend used by this MemoryPool (e.g. “jemalloc”).

bytes_allocated(self)

Return the number of bytes that are currently allocated from this memory pool.

max_memory(self)

Return the peak memory allocation in this memory pool. This can be an approximate number in multi-threaded applications.

None is returned if the pool implementation doesn’t know how to compute this number.

release_unused(self)

Attempt to return to the OS any memory being held onto by the pool.

This function should not be called except potentially for benchmarking or debugging as it could be expensive and detrimental to performance.

This is best effort and may not have any effect on some memory pools or in some situations (e.g. fragmentation).