Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-11488

[Rust]: StructBuilder's Drop impl leaks memory

    XMLWordPrintableJSON

Details

    Description

      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 `Box<dyn Any>`.

      Attachments

        Issue Links

          Activity

            People

              sfackler Steven Fackler
              sfackler Steven Fackler
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 2h 10m
                  2h 10m