You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Antoine Pitrou (Jira)" <ji...@apache.org> on 2021/08/04 09:56:01 UTC

[jira] [Assigned] (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 ]

Antoine Pitrou reassigned ARROW-4825:
-------------------------------------

    Assignee:     (was: Pearu Peterson)

> [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.3.4#803005)