This may happen when thread is teared down and it only has 1 block of BatchClass left and the freelist of BatchClass is empty. The side effect is that it leaks 1 block of BatchClass
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Are there already tests for this corner case?
compiler-rt/lib/scudo/standalone/primary64.h | ||
---|---|---|
217–218 | Is this comment not true any more? Otherwise, you are holding the lock while getStats could be called. |
compiler-rt/lib/scudo/standalone/primary64.h | ||
---|---|---|
210 | Shouldn't this be: PrintStats = Region->Exhausted; Since you only print the stats when it wasn't previously exhausted and the region is now exhausted? |
Rebase and amend missing code which was supposed to be included in last patch
compiler-rt/lib/scudo/standalone/primary64.h | ||
---|---|---|
210 | Per discussion, even though only region exhaustion will return false from populateFreeList(), any failure from populateFreeList() should be viewed as critical in BatchClass region. BTW, I thought I added a DCHECK(!Region->Exhausted) but it seems that I didn't include it... |
Shouldn't this be:
PrintStats = Region->Exhausted;
Since you only print the stats when it wasn't previously exhausted and the region is now exhausted?