Open Bug 1993183 Opened 1 day ago Updated 1 day ago

WeakMap memory is not correctly accounted for during sweeping

Categories

(Core :: JavaScript: GC, defect, P2)

defect

Tracking

()

People

(Reporter: jonco, Assigned: jonco)

References

(Blocks 1 open bug)

Details

Attachments

(4 files)

Looking at bug 1952626 I noticed during the test case we end up with relatively high heap size despite the fact that we're constantly generating garbage and then collecting it. It turns out that the way we calculate the retained size at the end of collection (used to calculate the next GC trigger threshold) is wrong for weak maps. We don't subtract weak map memory free during sweeping from the retained size for the zone. This leads to higher trigger thresholds, high heap sizes and fewer longer GCs.

This happens because we use ZoneAllocPolicy for JS WeakMaps which doesn't account for memory freed during sweeping. If we switch this to use CellAllocPolicy (for memory associated with a GC cell) then this should work.

This will not improve the overall performance of the testcase but is a step on the way to improving things.

Assignee: nobody → jcoppeard

Currently we have a few alias for commonly used WeakMap types. We're going to
add an alloc policy template parameter that's specific to the use so remove
these.

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

Finally, switch to using CellAllocPolicy for JS WeakMaps.

Severity: -- → S3
Priority: -- → P2
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: