Closed Bug 1685128 Opened 4 months ago Closed 4 months ago

Shrink unused nursery space in idle time


(Core :: JavaScript: GC, enhancement, P3)




86 Branch
Tracking Status
firefox86 --- fixed


(Reporter: jonco, Assigned: jonco)




(2 files)

Landing bug 1677765 and bug 1681533 both caused AWSY regressions because they affected the number of nursery collections. It turns out AWSY is very sensitive to that.

Performing too many nursery collections can shrink the nursery when it is in use, causing more things to be tenured and increasing memory use. But also, performing too few nursery collections can leave a large and unused nursery taking up memory unnecessarily.

Currently we collect the nursery when it is full, or nearly so if we have idle time. We should also collect the nursery when it isn't being used to give it the opportunity to shrink and release memory.

The aim here is to detect when the nursery isn't being used much and collect it
so that it can shrink itself (this doesn't change the sizing heuristics). This
ensures the nursery doesn't hold on to memory that could be better used for
other things.

There are many possible approaches but I went for the simplest - a fixed
timeout. If the nursery is above minimum size and as not been collected for 2
seconds then we collect it (if we're idle). This sounds drastic but is actually
quite a long time in terms of nursery collections, and only happens during idle
time when there is no JS code running.

This appears to fix the AWSY regressions for the other patches that affected
the number of nursery collections.

I always forget whether size is before or after resizing, so I added both.
Also I added the runtime pointer.

Blocks: 1683301
Blocks: 1681533
Pushed by
Collect the nursery during idle time if appears to be underused r=sfink
Add some more information to the nursery profiling output r=sfink
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → 86 Branch
Duplicate of this bug: 1550382
You need to log in before you can comment on or make changes to this bug.