Closed Bug 1529265 Opened 6 years ago Closed 6 years ago

ZoneGCStats::collectedZoneCount seems to be buggy/confusing

Categories

(Core :: JavaScript: GC, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla67
Tracking Status
firefox67 --- fixed

People

(Reporter: jandem, Assigned: jandem)

Details

Attachments

(1 file)

This field:

  /* Number of zones collected in this GC. */
  int collectedZoneCount = 0;

Is used here:

  bool isFullCollection() const {
    return collectedZoneCount == collectableZoneCount;
  }

Both of these fields are computed in GCRuntime::scanZonesBeforeGC:

    if (zone->canCollect()) {
      zoneStats.collectableZoneCount++;
    }
    if (zone->isGCScheduled()) {
      zoneStats.collectedZoneCount++;
      ...

It's possible however for a zone to have isGCScheduled() with canCollect() == false (via JS::PrepareForFullGC for example).

This can result in repeatedly triggering full GCs in Gecko:

https://searchfox.org/mozilla-central/rev/93905b660fc99a5d52b683690dd26471daca08c8/dom/base/nsJSEnvironment.cpp#2214

I think we shouldn't increment collectedZoneCount when zone->canCollect() is false?

Flags: needinfo?(sphink)

Makes sense to me.

Flags: needinfo?(sphink)
Pushed by sfink@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/0e59c9bfdc96
Don't include scheduled zones we can't collect in zoneStats.collectedZoneCount. r=sfink
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla67
Assignee: nobody → jdemooij
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: