Skip to content

Commit dbe0575

Browse files
committed
fix some rare hanging bug
1 parent 72d1abf commit dbe0575

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

kmc_core/kmc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,6 +1252,7 @@ template <unsigned SIZE> KMC::Stage1Results CKMC<SIZE>::ProcessStage1_impl()
12521252

12531253
buildSignatureMapping();
12541254

1255+
Queues.pmm_binary_file_reader->forget(); // seems there is a bug and not all parts get free during signature map building
12551256
// ***** Stage 1 *****
12561257

12571258
if (Params.file_type != InputType::BAM)

kmc_core/queues.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -897,6 +897,15 @@ class CMemoryPool {
897897
stack[i] = i;
898898
}
899899

900+
//Forgets about every allocation
901+
//After this pool may be reused like a new one, but this avoids reallocations
902+
void forget() {
903+
unique_lock<mutex> lck(mtx);
904+
n_parts_free = n_parts_total;
905+
for(uint32 i = 0; i < n_parts_total; ++i)
906+
stack[i] = i;
907+
}
908+
900909
void release(void) {
901910
if(raw_buffer)
902911
delete[] raw_buffer;

0 commit comments

Comments
 (0)