Closed Bug 1685128 Opened 3 years ago Closed 3 years ago

Shrink unused nursery space in idle time

Categories

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

enhancement

Tracking

()

RESOLVED FIXED
86 Branch
Tracking Status
firefox86 --- fixed

People

(Reporter: jonco, Assigned: jonco)

References

Details

Attachments

(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 jcoppeard@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/dc3237308ff0
Collect the nursery during idle time if appears to be underused r=sfink
https://hg.mozilla.org/integration/autoland/rev/a426ccf784b7
Add some more information to the nursery profiling output r=sfink
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 86 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: