Buffers and Memory

In-Memory Buffers

Factory Functions

allocate_buffer(int64_t size, …[, resizable])

Allocate a mutable buffer.

py_buffer(obj)

Construct an Arrow buffer from a Python bytes-like or buffer-like object

foreign_buffer(address, size[, base])

Construct an Arrow buffer with the given address and size.

Classes

Buffer()

The base class for all Arrow buffers.

ResizableBuffer

A base class for buffers that can be resized.

Miscellaneous

compress(buf[, codec, asbytes, memory_pool])

Compress data from buffer-like object.

decompress(buf[, decompressed_size, codec, …])

Decompress data from buffer-like object.

Memory Pools

MemoryPool()

Base class for memory allocation.

default_memory_pool()

Return the process-global memory pool.

jemalloc_memory_pool()

Return a memory pool based on the jemalloc heap.

mimalloc_memory_pool()

Return a memory pool based on the mimalloc heap.

system_memory_pool()

Return a memory pool based on the C malloc heap.

jemalloc_set_decay_ms(decay_ms)

Set arenas.dirty_decay_ms and arenas.muzzy_decay_ms to indicated number of milliseconds.

set_memory_pool(MemoryPool pool)

log_memory_allocations([enable])

Enable or disable memory allocator logging for debugging purposes

total_allocated_bytes()

Return the currently allocated bytes from the default memory pool.