You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Steven Fackler (Jira)" <ji...@apache.org> on 2021/02/03 21:32:00 UTC

[jira] [Created] (ARROW-11488) [Rust]: StructBuilder's Drop impl leaks memory

Steven Fackler created ARROW-11488:
--------------------------------------

             Summary: [Rust]: StructBuilder's Drop impl leaks memory
                 Key: ARROW-11488
                 URL: https://issues.apache.org/jira/browse/ARROW-11488
             Project: Apache Arrow
          Issue Type: Bug
          Components: Rust
    Affects Versions: 3.0.0
            Reporter: Steven Fackler


The StructBuilder stores two copies of the inner ArrayBuilders in two separate Vecs via some unsafe code. To avoid double-dropping the builders, the StructBuilder Drop impl uses mem::forget on one of the vectors. This avoids calling the destructor of the ArrayBuilders twice, but also leaks the memory of the Vec itself.

In addition, the double-vecs with the unsafe code is completely unnecessary since you can just call `ArrayBuilder::as_mut_any` on the `dyn ArrayBuilder` instead of having to covert to a `dyn Any`.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)