From c37988e025ddbe39925c32968d7b35f2544878fc Mon Sep 17 00:00:00 2001 From: Paul Bone Date: Thu, 4 Apr 2024 00:03:27 +0000 Subject: [PATCH] Bug 1888326 - Advance the chunk index after committing pages r=glandium Differential Revision: https://phabricator.services.mozilla.com/D205971 --- memory/build/mozjemalloc.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/memory/build/mozjemalloc.cpp b/memory/build/mozjemalloc.cpp index b42c06ea603c..9c63705ce752 100644 --- a/memory/build/mozjemalloc.cpp +++ b/memory/build/mozjemalloc.cpp @@ -2639,7 +2639,8 @@ bool arena_t::SplitRun(arena_run_t* aRun, size_t aSize, bool aLarge, size_t rem_pages = total_pages - need_pages; #ifdef MALLOC_DECOMMIT - for (size_t i = 0; i < need_pages; i++) { + size_t i = 0; + while (i < need_pages) { // Commit decommitted pages if necessary. If a decommitted // page is encountered, commit all needed adjacent decommitted // pages in one operation, in order to reduce system call @@ -2685,6 +2686,9 @@ bool arena_t::SplitRun(arena_run_t* aRun, size_t aSize, bool aLarge, } mNumFresh += j; + i += j; + } else { + i++; } } #endif