[compiler-rt] [scudo] Allow to resize allocation ring buffer (PR #82683)

via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 5 14:28:28 PST 2024


================
@@ -1535,11 +1537,15 @@ class Allocator {
         RBEntryStart)[N];
   }
 
-  void mapAndInitializeRingBuffer() {
-    if (getFlags()->allocation_ring_buffer_size <= 0)
-      return;
-    u32 AllocationRingBufferSize =
-        static_cast<u32>(getFlags()->allocation_ring_buffer_size);
+  bool mapAndInitializeRingBuffer(int RingBufferSize) {
+    if (RingBufferSize < 0 ||
+        static_cast<unsigned int>(RingBufferSize) >= UINT32_MAX)
+      return false;
+    if (RingBufferSize == 0) {
+      swapOutRingBuffer(nullptr);
+      return true;
+    }
----------------
ChiaHungDuan wrote:

Now I feel like we may want to hint when TrackAllocationStacks is set but the ring buffer is nullptr.

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


More information about the llvm-commits mailing list