tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit f8b3beb4090fa8ae59f5ec9a91087ef09f52f355
parent 4f9e513a488d238d7c090e3ecbd09e51b54631c2
Author: Jon Coppeard <jcoppeard@mozilla.com>
Date:   Mon, 13 Oct 2025 13:35:10 +0000

Bug 1993183 - Part 3: Update retained size for CellAllocPolicy during sweeping as well as finalizing r=sfink

The GC context's use is sweeping during weak map sweeping so make sure
deallocations here get accounted for in the retained size.

Differential Revision: https://phabricator.services.mozilla.com/D267939

Diffstat:
Mjs/src/gc/GCContext.h | 1+
Mjs/src/gc/Zone.cpp | 2+-
2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/js/src/gc/GCContext.h b/js/src/gc/GCContext.h @@ -106,6 +106,7 @@ class GCContext { js::gc::GCUse gcUse() const { return gcUse_; } bool isCollecting() const { return gcUse() != js::gc::GCUse::None; } + bool isSweeping() const { return gcUse_ == js::gc::GCUse::Sweeping; } bool isFinalizing() const { return gcUse_ == js::gc::GCUse::Finalizing; } #ifdef DEBUG diff --git a/js/src/gc/Zone.cpp b/js/src/gc/Zone.cpp @@ -144,7 +144,7 @@ void js::TrackedAllocPolicy<kind>::decMemory(size_t nbytes) { // Only subtract freed cell memory from retained size for cell associations // during sweeping. JS::GCContext* gcx = TlsGCContext.get(); - updateRetainedSize = gcx->isFinalizing(); + updateRetainedSize = gcx->isSweeping() || gcx->isFinalizing(); } zone_->decNonGCMemory(this, nbytes, MemoryUse::TrackedAllocPolicy,