Skip to content

Commit

Permalink
Fix deadlock in tbbmalloc raportFreeBlocks function (#1117)
Browse files Browse the repository at this point in the history
trylockblock() locks mutex in the current element and mutex in right
neighbor, so we have to free both locks.

Signed-off-by: Łukasz Plewa <lukasz.plewa@intel.com>
  • Loading branch information
lplewa authored Jun 13, 2023
1 parent 3f657a3 commit c7865c1
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/tbbmalloc/backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1458,6 +1458,7 @@ size_t Backend::Bin::reportFreeBlocks(FILE *f)
for (FreeBlock *fb = head; fb; fb = fb->next) {
size_t sz = fb->tryLockBlock();
fb->setMeFree(sz);
fb->rightNeig(sz)->setLeftFree(sz);
fprintf(f, " [%p;%p]", fb, (void*)((uintptr_t)fb+sz));
totalSz += sz;
}
Expand Down

0 comments on commit c7865c1

Please sign in to comment.