WeakMap memory is not correctly accounted for during sweeping
Categories
(Core :: JavaScript: GC, defect, P2)
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 | ||
Updated•1 day ago
|
Assignee | ||
Comment 1•1 day ago
|
||
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.
Assignee | ||
Comment 2•1 day ago
|
||
Assignee | ||
Comment 3•1 day ago
|
||
The GC context's use is sweeping during weak map sweeping so make sure
deallocations here get accounted for in the retained size.
Assignee | ||
Comment 4•1 day ago
|
||
Finally, switch to using CellAllocPolicy for JS WeakMaps.
Updated•1 day ago
|
Description
•