Bug 894993 - 'SessionWorker takes lots of memory'. r=billm+khuey.

This commit is contained in:
Ben Turner 2013-07-25 15:03:27 -04:00
parent 40cfac1eb1
commit 4db2bb9f11
2 changed files with 3 additions and 5 deletions

View File

@ -4262,9 +4262,10 @@ WorkerPrivate::GarbageCollectInternal(JSContext* aCx, bool aShrinking,
{
AssertIsOnWorkerThread();
if (aCollectChildren) {
if (aShrinking || aCollectChildren) {
JSRuntime* rt = JS_GetRuntime(aCx);
JS::PrepareForFullGC(rt);
if (aShrinking) {
JS::ShrinkingGC(rt, JS::gcreason::DOM_WORKER);
}
@ -4273,10 +4274,6 @@ WorkerPrivate::GarbageCollectInternal(JSContext* aCx, bool aShrinking,
}
}
else {
// If aCollectChildren is false then it means this collection request was
// not generated by the main thread. At the moment only the periodic GC
// timer can end up here, so rather than force a collection let the JS
// engine decide if we need one.
JS_MaybeGC(aCx);
}

View File

@ -206,6 +206,7 @@ JSRuntime::setGCMaxMallocBytes(size_t value)
* mean that value.
*/
gcMaxMallocBytes = (ptrdiff_t(value) >= 0) ? value : size_t(-1) >> 1;
resetGCMallocBytes();
for (ZonesIter zone(this); !zone.done(); zone.next())
zone->setGCMaxMallocBytes(value);
}