Skip to content

Conversation

@Donwulff
Copy link

Fixes memory leak in PairEndProcessor::interleavedReaderTask() where ReadPair objects were not being freed, resulting in a leak of 16 bytes per read pair across the input (Issue #392 ).

Changes:

  • Modified call signatures to reuse the same ReadPair for all reads, as it's a return container for the Read pairs.
  • Added a method to detect the end of input for clarity.
  • Updated freeing of the Read arrays to utilize array delete.

Performance Metrics Comparison on 1KG HG00312 exome with 110M reads:

Metric Before After
User time (seconds) 1524.60 1507.94
Maximum resident set size (kbytes) 4423400 2548668

All results remained identical.

@bwlang
Copy link

bwlang commented Oct 13, 2025

I observed memory leaks as well when running fastp like this:

fastp --stdin -l 2 -Q --trim_poly_g --thread 1  -j library1.fastp.json --split_by_lines 8000000 --interleaved_in --out1 library1.1.trimmed.fastq --out2 library1.2.trimmed.fastq

after applying this commit and rebuilding

make LIBRARY_DIRS=$CONDA_PREFIX/lib INCLUDE_DIRS=$CONDA_PREFIX/include -j 32
patchelf --set-rpath $CONDA_PREFIX/lib ./fastp
cp fastp $CONDA_PREFIX/bin

the problems we were seeing with fastp getting killed by the cluster manger(exceeded 16G) have been resolved.

image

@sfchen : any concerns about merging this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants