[compiler-rt] [scudo] Only init RingBuffer when needed. (PR #85994)

via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 27 16:19:26 PDT 2024


================
@@ -1546,11 +1547,17 @@ class Allocator {
         RBEntryStart)[N];
   }
 
-  void mapAndInitializeRingBuffer() {
-    if (getFlags()->allocation_ring_buffer_size <= 0)
+  void initRingBufferMaybe() {
+    static HybridMutex RingBufferLock;
+    ScopedLock L(RingBufferLock);
----------------
ChiaHungDuan wrote:

I'm thinking the case mentioned [here](https://github.com/llvm/llvm-project/pull/79670#discussion_r1469997581), does that mean we can't put this lock as static local variable? 

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


More information about the llvm-commits mailing list