diff --git a/src/peprocessor.cpp b/src/peprocessor.cpp index 8ff63b9..b54ce4d 100644 --- a/src/peprocessor.cpp +++ b/src/peprocessor.cpp @@ -58,6 +58,12 @@ PairEndProcessor::~PairEndProcessor() { delete mRightReadPool; mRightReadPool = NULL; } + for(int t=0; tthread; t++){ + delete mLeftInputLists[t]; + delete mRightInputLists[t]; + } + delete[] mLeftInputLists; + delete[] mRightInputLists; } void PairEndProcessor::initOutput() { diff --git a/src/read.cpp b/src/read.cpp index c155784..05a1bd1 100644 --- a/src/read.cpp +++ b/src/read.cpp @@ -56,7 +56,6 @@ Read* Read::reverseComplement(){ string seq = Sequence::reverseComplement(mSeq); string qual; qual.assign(mQuality->rbegin(), mQuality->rend()); - string* strand=new string("+"); return new Read(mName->c_str(), seq.c_str(), "+", qual.c_str()); } diff --git a/src/readpool.cpp b/src/readpool.cpp index 577c8f9..c5bd953 100644 --- a/src/readpool.cpp +++ b/src/readpool.cpp @@ -31,8 +31,15 @@ bool ReadPool::input(int tid, Read* data) { } void ReadPool::cleanup() { - //TODO: delete unused pooled Reads. - //But since this is only called when the program exits, the one-by-one deletion can be skipped to save time + for(int t=0; tthread; t++) { + while(mBufferLists[t]->canBeConsumed()) { + Read* r = mBufferLists[t]->consume(); + mConsumed++; + delete r; + } + delete mBufferLists[t]; + } + delete[] mBufferLists; } void ReadPool::initBufferLists() { diff --git a/src/seprocessor.cpp b/src/seprocessor.cpp index ccb7b11..41fc921 100644 --- a/src/seprocessor.cpp +++ b/src/seprocessor.cpp @@ -41,6 +41,10 @@ SingleEndProcessor::~SingleEndProcessor() { delete mReadPool; mReadPool = NULL; } + for(int t=0; tthread; t++){ + delete mInputLists[t]; + } + delete[] mInputLists; } void SingleEndProcessor::initOutput() { diff --git a/src/singleproducersingleconsumerlist.h b/src/singleproducersingleconsumerlist.h index dd90b4b..ee80647 100644 --- a/src/singleproducersingleconsumerlist.h +++ b/src/singleproducersingleconsumerlist.h @@ -83,6 +83,8 @@ class SingleProducerSingleConsumerList { blocks[recycled & blocksRingBufferSizeMask] = NULL; recycled++; } + delete[] blocks; + blocks = NULL; } inline size_t size() { return produced - consumed; diff --git a/src/threadconfig.cpp b/src/threadconfig.cpp index 02ebd2a..b3f2407 100644 --- a/src/threadconfig.cpp +++ b/src/threadconfig.cpp @@ -41,6 +41,26 @@ void ThreadConfig::cleanup() { delete mRightInputList; mRightInputList = NULL; } + if(mPreStats1) { + delete mPreStats1; + mPreStats1 = NULL; + } + if(mPostStats1) { + delete mPostStats1; + mPostStats1 = NULL; + } + if(mPreStats2) { + delete mPreStats2; + mPreStats2 = NULL; + } + if(mPostStats2) { + delete mPostStats2; + mPostStats2 = NULL; + } + if(mFilterResult) { + delete mFilterResult; + mFilterResult = NULL; + } } diff --git a/src/writerthread.cpp b/src/writerthread.cpp index df6c508..f64f2ff 100644 --- a/src/writerthread.cpp +++ b/src/writerthread.cpp @@ -55,6 +55,11 @@ void WriterThread::input(int tid, string* data) { void WriterThread::cleanup() { deleteWriter(); + for(int t=0; tthread; t++) { + delete mBufferLists[t]; + } + delete[] mBufferLists; + mBufferLists = NULL; } void WriterThread::deleteWriter() {