From 091243e8f50e76692b7ab6d5bf886802d9e3b62b Mon Sep 17 00:00:00 2001 From: Paul Bone Date: Tue, 20 May 2025 05:54:23 +0000 Subject: [PATCH] Bug 1967195 - Remove the chunk_assert_zero check r=glandium Differential Revision: https://phabricator.services.mozilla.com/D249941 --- memory/build/mozjemalloc.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/memory/build/mozjemalloc.cpp b/memory/build/mozjemalloc.cpp index ce713eebf4e3..ecd203a23d6c 100644 --- a/memory/build/mozjemalloc.cpp +++ b/memory/build/mozjemalloc.cpp @@ -212,6 +212,10 @@ using namespace mozilla; # define MALLOC_RUNTIME_CONFIG #endif +// Uncomment this to enable extra-vigilant assertions. These assertions may run +// more expensive checks that are sometimes too slow for regular debug mode. +// #define MALLOC_DEBUG_VIGILANT + // When MALLOC_STATIC_PAGESIZE is defined, the page size is fixed at // compile-time for better performance, as opposed to determined at // runtime. Some platforms can have different page sizes at runtime @@ -2814,12 +2818,15 @@ static void* chunk_alloc(size_t aSize, size_t aAlignment, bool aBase) { #ifdef MOZ_DEBUG static void chunk_assert_zero(void* aPtr, size_t aSize) { +// Only run this expensive check in a vigilant mode. +# ifdef MALLOC_DEBUG_VIGILANT size_t i; size_t* p = (size_t*)(uintptr_t)aPtr; for (i = 0; i < aSize / sizeof(size_t); i++) { MOZ_ASSERT(p[i] == 0); } +# endif } #endif