rust_htslib::faidx::Reader::fetch_seq()
causing a memory leak.
#15
Labels
bug
Something isn't working
rust_htslib::faidx::Reader::fetch_seq()
causing a memory leak.
#15
Bug Description
pmd-mask
is currently showing clear signs of a memory leak. (i.e.: image below)pmd-mask
on high-coverage samples.Running
heaptrack
clearly shows a single culprit:The only call site to this function is in
lib::apply_pmd_mask():81
Minimally reproducible example
Execute
pmd-mask
on any available input, while profiling the memory consumption withheaptrack
A 'hackier' way to monitor memory consumption and see the gradual increase, using
top
andgrep
:Impact and current size-complexity of
pmd-mask
Looking at the [
htslib::faidx_fetch_seq64()
] call site withinfaidx::Reader::fetch_seq()
shows the most likely 'leakage' is the byte_string representation of each reference sequence (see:rust-htslib/src/faidx/mod.rs:73-79
).Thus, the current size complexity when processing a file is$O(n \cdot \widehat{L})$ , with $n$ , the number of reads within the file, and $\widehat{L}$ , the average fragment length.
A (temporary) workaround when working with high-coverage samples
Apply
pmd-mask
sequentially on each chromosome.The following set of bash commands should help mitigate the overall memory consumption until a fix is found..
Assumptions:
$REFERENCE
must be accompanied by a.fai
index file in the same directory.pmd-mask
must be within your $PATHThe text was updated successfully, but these errors were encountered: