Closed Bug 926681 Opened 7 years ago Closed 7 years ago

js::TriggerZoneGC will never trigger a GC in single-threaded builds

Categories

(Core :: JavaScript Engine, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla27

People

(Reporter: jimb, Assigned: jonco)

Details

Attachments

(1 file)

In a single-threaded build, JSRuntime::currentThreadOwnsOperationCallbackLock always returns true, which means that js::TriggerZoneGC always returns without triggering a GC.

Even if that were not the case:

Because Zone::updateMallocCounter (like JSRuntime::updateMallocCounter) only calls onTooMuchMalloc when gcMallocBytes crosses zero, not whenever it's less than zero, if that call to Zone::onTooMuchMalloc declines to actually request a GC, Zone::updateMallocCounter will never ask again. If js::TriggerZoneGC is not going to guarantee that the GC is requested, updateMallocCounter seems incorrect. (This is the same mistake described in bug 926678, but in JS::Zone, not JSRuntime.)
Here's a patch to make single threaded builds more similar to threadsafe ones by making currentThreadOwnsOperationCallbackLock() return whether we are inside an AutoLockForOperationCallback.

(The other part of this bug is addressed in bug 26678.)
Assignee: nobody → jcoppeard
Status: NEW → ASSIGNED
Attachment #817755 - Flags: review?(wmccloskey)
Comment on attachment 817755 [details] [diff] [review]
bug926681-triggerGc

Maybe Brian can look at this. I don't know anything about this code.
Attachment #817755 - Flags: review?(wmccloskey) → review?(bhackett1024)
Attachment #817755 - Flags: review?(bhackett1024) → review+
https://hg.mozilla.org/mozilla-central/rev/440098bca4eb
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla27
You need to log in before you can comment on or make changes to this bug.