[ https://issues.apache.org/jira/browse/ARROW-4825?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Rok Mihevc updated ARROW-4825: ------------------------------ External issue URL: https://github.com/apache/arrow/issues/16014 > [Python][C++] MemoryPool is destructed before deallocating its buffers leads > to segfault > ----------------------------------------------------------------------------------------- > > Key: ARROW-4825 > URL: https://issues.apache.org/jira/browse/ARROW-4825 > Project: Apache Arrow > Issue Type: Bug > Components: C++, Python > Affects Versions: 0.13.0 > Reporter: Pearu Peterson > Priority: Major > Labels: pull-request-available > Time Spent: 15.5h > Remaining Estimate: 0h > > Consider the following test function: > ``` > def test_memory_pool(): > import pyarrow as pa > pool = pa.logging_memory_pool(pa.default_memory_pool()) > buf = pa.allocate_buffer(10, memory_pool=pool) > ``` > that will fail with segfault when `pool` is garbage collected before `buf`. > However, the following test function succeeds: > ``` > def test_memory_pool(): > import pyarrow as pa > pool = pa.logging_memory_pool(pa.default_memory_pool()) > buf = pa.allocate_buffer(10, memory_pool=pool) > del buf > ``` > because all buffers are freed before `pool` destruction. > To fix this issue, the pool instance should be attached to buffer instances > that the pool is creating. This will ensure that `pool` will be alive until > all its buffers are destroyed. -- This message was sent by Atlassian Jira (v8.20.10#820010)