You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Parquet][C++] ipc::SerializeSchema() allocates from the default memory pool instead of the pool it is given #55623
Describe the bug, including details regarding any error messages, version, and platform.
arrow::ipc::SerializeSchema(const Schema& schema, MemoryPool* pool) allocates from default_memory_pool() even though a pool is passed explicitly.
pool is given only to the output BufferOutputStream. The writer is built with IpcWriteOptions::Defaults(), whose memory_pool is default_memory_pool(), so the flatbuffer schema message (WriteFBMessage → WriteFlatbufferBuilder → AllocateBuffer) is allocated from the default pool:
(cpp/src/arrow/ipc/writer.cc, unchanged on main at ab5b422)
Parquet calls SerializeSchema() from GetSchemaMetadata() (cpp/src/parquet/arrow/writer.cc) in FileWriter::Open() when ArrowWriterProperties::store_schema() is set, so a Parquet writer opened with an explicit pool also allocates from the default pool.
Found while using a custom memory pool: allocations escape the pool, which defeats pool accounting and limits. Where the default pool is mimalloc and the program runs under valgrind, this also shows up as Invalid free() reports, since valgrind intercepts libmimalloc's free but not mi_malloc_aligned.
Reproducer (Arrow 23.0.1, Ubuntu packages, x86_64; default pool mimalloc):
changed the title [-][C++] ipc::SerializeSchema() allocates from the default memory pool instead of the pool it is given[/-][+][Parquet][C++] ipc::SerializeSchema() allocates from the default memory pool instead of the pool it is given[/+]on Nov 15, 2026
The same pattern exists in two sibling functions in cpp/src/arrow/ipc/writer.cc, and the PR fixes them too:
GetTensorMessage(tensor, pool) uses pool only to make a non-contiguous tensor contiguous; the tensor message's flatbuffer is allocated from the default pool.
GetSparseTensorPayload(sparse_tensor, pool, out) (and so GetSparseTensorMessage(sparse_tensor, pool)) never uses pool.
No other IPC function that takes a MemoryPool* allocates from the default pool.
Activity
[-][C++] ipc::SerializeSchema() allocates from the default memory pool instead of the pool it is given[/-][+][Parquet][C++] ipc::SerializeSchema() allocates from the default memory pool instead of the pool it is given[/+]davidnich commentedon Nov 16, 2026
The same pattern exists in two sibling functions in
cpp/src/arrow/ipc/writer.cc, and the PR fixes them too:GetTensorMessage(tensor, pool)usespoolonly to make a non-contiguous tensor contiguous; the tensor message's flatbuffer is allocated from the default pool.GetSparseTensorPayload(sparse_tensor, pool, out)(and soGetSparseTensorMessage(sparse_tensor, pool)) never usespool.No other IPC function that takes a
MemoryPool*allocates from the default pool.