[compiler-rt] [scudo] Fix release to OS logic in secondary cache. (PR #103303)

via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 13 16:22:42 PDT 2024


================
@@ -336,6 +336,31 @@ TEST_F(MapAllocatorCacheTest, CacheOrder) {
     MemMap.unmap();
 }
 
+TEST_F(MapAllocatorCacheTest, CacheOrderWithRelease) {
+  std::vector<scudo::MemMapT> MemMaps;
+  Cache->setOption(scudo::Option::MaxCacheEntriesCount,
+                   CacheConfig::getEntriesArraySize());
+
+  fillCacheWithSameSizeBlocks(MemMaps, CacheConfig::getEntriesArraySize() - 1,
+                              TestAllocSize);
+
+  // Enable releases and perform a deallocation to trigger releases
+  Cache->setOption(scudo::Option::ReleaseInterval, 0);
----------------
ChiaHungDuan wrote:

Doing a releaseToOS() moves all the entries to the decommited list and when we have to do eviction, it's supposed to pop the decommited list first. If the order is reversed, then we should be able to detect it, right?

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


More information about the llvm-commits mailing list