Closed
Bug 522245
Opened 16 years ago
Closed 7 years ago
It should be possible to initiate cycle collection without nsIDOMWindowUtils
Categories
(Core :: XPConnect, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: avarma, Unassigned)
References
Details
In Jetpack's test suite, we use Components.utils.forceGC() in concert with Components.utils.getWeakReference() to "track" objects of interest and ensure that unit/functional tests don't have memory leaks (this is intended to help find memory leaks in the underlying implementation).
We found, though, that when making weak references to DOM objects like iframes, Cu.forceGC() didn't get rid of them--but that the iframe would eventually disappear.
I realized a few days ago while learning about the cycle collector that this is due to the fact that Cu.forceGC() is a simple wrapper for the JSAPI's JS_GC(), which itself doesn't result in cycle collection. In order for cycle collection to occur, nsCycleCollector_collect() needs to be called.
I can see two ways of enabling this:
(1) Modify Cu.forceGC() to call nsCycleCollector_collect() instead of JS_GC(). There's no need to additionally call JS_GC() because performing cycle collection also performs standard mark-and-sweep GC'ing.
(2) Add a new Cu.forceCC() or Cu.forceCycleCollection() function that calls nsCycleCollector_collect().
I'd be happy to provide a patch for either. Just let me know which is preferred, or if you have a better solution in mind.
Comment 1•16 years ago
|
||
As Olli points out, you can do a cycle collection via a window's nsIDOMWindowUtils, so that should work for JetPack.
Other folks need this from xpcshell or from a JS component, however, where windows are not available. Let's morph this bug to cover those cases.
OS: Mac OS X → All
Summary: It should be possible to initiate cycle collection from chrome script → It should be possible to initiate cycle collection without nsIDOMWindowUtils
Version: 1.9.1 Branch → Trunk
Comment 3•16 years ago
|
||
Related to bug 465809?
Comment 4•7 years ago
|
||
Per policy at https://wiki.mozilla.org/Bug_Triage/Projects/Bug_Handling/Bug_Husbandry#Inactive_Bugs. If this bug is not an enhancement request or a bug not present in a supported release of Firefox, then it may be reopened.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → INACTIVE
Comment 5•7 years ago
|
||
Fixed in bug 781700: Cu.forceCC() works.
Depends on: 781700
Resolution: INACTIVE → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•