[compiler-rt] [scudo] Update secondary cache time-based release logic. (PR #107507)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 12 14:54:48 PDT 2024


================
@@ -535,6 +533,9 @@ class MapAllocatorCache {
       Entries[LRUHead].Prev = static_cast<u16>(FreeIndex);
     }
 
+    if (LastUnreleasedEntry == CachedBlock::InvalidEntry)
+      LastUnreleasedEntry = static_cast<u16>(FreeIndex);
----------------
ChiaHungDuan wrote:

```suggestion
    if (LastUnreleasedEntry == CachedBlock::InvalidEntry) {
      LastUnreleasedEntry = static_cast<u16>(FreeIndex);
    } else {
       DCHECK(Entries[LastUnreleasedEntry].Next == CachedBlock::InvalidEntry ||
              Entries[Entries[LastUnreleasedEntry].Next].Time == 0);
    }
```
I suppose this will catch the uninitialized LastUnreleasedEntry, could you verify this?

https://github.com/llvm/llvm-project/pull/107507


More information about the llvm-commits mailing list