[compiler-rt] [scudo] Refactor store() and retrieve(). (PR #102024)

via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 5 15:50:58 PDT 2024


================
@@ -807,7 +821,12 @@ void MapAllocator<Config>::deallocate(const Options &Options, void *Ptr)
     Stats.sub(StatAllocated, CommitSize);
     Stats.sub(StatMapped, H->MemMap.getCapacity());
   }
-  Cache.store(Options, H);
+
+  if (!Cache.canCache(H->CommitSize))
+    unmap(H->MemMap);
+  else
+    Cache.store(Options, H->CommitBase, H->CommitSize,
+                reinterpret_cast<uptr>(H + 1), H->MemMap);
----------------
ChiaHungDuan wrote:

nit: Curly brackets because of multiple lines (then `if` needs it too)

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


More information about the llvm-commits mailing list