You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "Pearu Peterson (JIRA)" <ji...@apache.org> on 2019/03/11 21:55:00 UTC
[jira] [Updated] (ARROW-4825) [Python][C++] MemoryPool is
destructed before deallocating its buffers leads to segfault
[ https://issues.apache.org/jira/browse/ARROW-4825?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Pearu Peterson updated ARROW-4825:
----------------------------------
Summary: [Python][C++] MemoryPool is destructed before deallocating its buffers leads to segfault (was: [Python] MemoryPool is destructed before deallocating its buffers leads to segfault )
> [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: Python
> Affects Versions: 0.13.0
> Reporter: Pearu Peterson
> Priority: Major
>
> 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
(v7.6.3#76005)