[compiler-rt] 9f96f1c - [sanitizer] print both class id and corresponding size when region is exhausted (#116186)

via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 14 12:18:15 PST 2024


Author: Enna1
Date: 2024-11-14T12:18:11-08:00
New Revision: 9f96f1cb6f2c7a987de590cbb02780df15c60f18

URL: https://github.com/llvm/llvm-project/commit/9f96f1cb6f2c7a987de590cbb02780df15c60f18
DIFF: https://github.com/llvm/llvm-project/commit/9f96f1cb6f2c7a987de590cbb02780df15c60f18.diff

LOG: [sanitizer] print both class id and corresponding size when region is exhausted (#116186)

Added: 
    

Modified: 
    compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h b/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h
index 0b0bdb07041e5b..51ac1b6ae49757 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h
@@ -185,9 +185,10 @@ class SizeClassAllocator64 {
     // recoverable.
     if (UNLIKELY(!EnsureFreeArraySpace(region, region_beg,
                                        new_num_freed_chunks))) {
-      Report("FATAL: Internal error: %s's allocator exhausted the free list "
-             "space for size class %zd (%zd bytes).\n", SanitizerToolName,
-             class_id, ClassIdToSize(class_id));
+      Report(
+          "FATAL: Internal error: %s's allocator exhausted the free list "
+          "space for size class %zu (%zu bytes).\n",
+          SanitizerToolName, class_id, ClassIdToSize(class_id));
       Die();
     }
     for (uptr i = 0; i < n_chunks; i++)
@@ -763,8 +764,9 @@ class SizeClassAllocator64 {
     if (!region->exhausted) {
       region->exhausted = true;
       Printf("%s: Out of memory. ", SanitizerToolName);
-      Printf("The process has exhausted %zuMB for size class %zu.\n",
-             kRegionSize >> 20, ClassIdToSize(class_id));
+      Printf(
+          "The process has exhausted %zu MB for size class %zu (%zu bytes).\n",
+          kRegionSize >> 20, class_id, ClassIdToSize(class_id));
     }
     return true;
   }


        


More information about the llvm-commits mailing list