Bug 1937711 - Fix an inaccurate comment in mozjemalloc.cpp r=glandium DONTBUILD

Differential Revision: https://phabricator.services.mozilla.com/D232312
This commit is contained in:
Paul Bone
2024-12-19 06:54:34 +00:00
parent 5f7fc1b17d
commit f07ebc3b80

View File

@@ -3234,13 +3234,20 @@ bool arena_t::Purge(bool aForce) {
return false; return false;
} }
// Take a single chunk and purge some of its dirty pages. This will perform // Take a single chunk and attempt to purge some of its dirty pages. The
// only one system call. The caller can use a loop to purge more memory. // loop below will purge memory from the chunk until either:
// * The dirty page count for the arena hits its target,
// * Another thread attempts to delete this chunk, or
// * The chunk has no more dirty pages.
// In any of these cases the loop will break and Purge() will return, which
// means it may return before the arena meets its dirty page count target,
// the return value is used by the caller to call Purge() again where it
// will take the next chunk with dirty pages.
chunk = mChunksDirty.Last(); chunk = mChunksDirty.Last();
if (!chunk) { if (!chunk) {
// There are chunks with dirty pages (because mNumDirty > 0 above) but // There are chunks with dirty pages (because mNumDirty > 0 above) but
// they're not in mChunksDirty. That can happen if they're busy being // they're not in mChunksDirty. That can happen if they're busy being
// purged. // purged by other threads.
return false; return false;
} }
MOZ_ASSERT(chunk->ndirty > 0); MOZ_ASSERT(chunk->ndirty > 0);