Skip to content

Memory leaks when using delta_scan #279

@kdang-at-safe

Description

@kdang-at-safe

We encountered some memory leaks when DuckDB is built with the address sanitizer. The problem occurs when reading from a delta table using delta_scan().

Repro

  • Build DuckDB and Delta Extension with address sanitizer.
  • In DuckDB console, run select * from delta_scan('/path/to/some-table');
  • Exit console, and memory leaks are dumped.

I've attached the table I used, and the asan logs that were dumped for me:

some-table.zip
sanitize asan leaks.txt

Notes

I am unsure whether this problem is from the Delta extension, or the Delta Kernel. But this is what I found while looking into it a bit.

  • The problem appears to occur in DeltaMultiFileList::GetFileInternal() after ffi::scan_metadata_next() was called.
  • I tried the ffi/examples/read-table example in delta-kernel-rs which used the same call, and it did not have any memory leaks reported.
  • The attached log of memory leaks were from one run of delta_scan(). Each subsequent call to delta_scan() increases the leak size.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions