Add API to do cycle collection (CC) on command

RESOLVED FIXED

Status

()

RESOLVED FIXED
12 years ago
11 years ago

People

(Reporter: sicking, Assigned: sicking)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

We should add an API to make it possible to force a cycle-collection on command. This would be useful both for testing purposes during performance tests, and useful for crash-testing during fuzzing.

Patch coming up.
Comment on attachment 284069 [details] [diff] [review]
Patch to fix


>+
>+	/**
>+	 * Force a garbage collection. This will run the cycle-collector twice to
>+	 * make sure all garbage is collected.
>+	 */

Why it is actually needed to run CC twice? Didn't you say something that Peterv's patch
fixes that?
It will, but that patch hasn't landed yet.
Attachment #284069 - Flags: superreview?(jst)
Attachment #284069 - Flags: review?(jst)
Comment on attachment 284069 [details] [diff] [review]
Patch to fix

    * @param aElement the element to focus
    */
   void focus(in nsIDOMElement aElement);
+
+	/**
+	 * Force a garbage collection. This will run the cycle-collector twice to
+	 * make sure all garbage is collected.
+	 */
+	void garbageCollect();

Dude, no tabs! :) And add to the comment that this is only callable with elevated privs (feel free to ignore the debug aspect of that if you want to).

r+sr+a=jst with that.
Attachment #284069 - Flags: superreview?(jst)
Attachment #284069 - Flags: superreview+
Attachment #284069 - Flags: review?(jst)
Attachment #284069 - Flags: review+
Attachment #284069 - Flags: approval1.9+
Checked in
Status: NEW → RESOLVED
Last Resolved: 12 years ago
Resolution: --- → FIXED
What is the difference between this method and Components.utils.forceGC() ?
That calls JavaScript garbage collector, the one here calls cycle collector.
But yes, perhaps those should be somehow in the same API.
Is Components.utils accessible from C++?
and is Components.utils accessible from content javascript? The new API is in debug builds.
Well, I can call Components.utils.forceGC() when I have enhanced privs, not sure if that answers the questions in comment 7 or comment 8, though.
You need to log in before you can comment on or make changes to this bug.