Closed Bug 1351346 Opened 7 years ago Closed 5 years ago

Please add support for memory reporters


(WebExtensions :: Experiments, enhancement, P3)



(firefox55 affected)

Tracking Status
firefox55 --- affected


(Reporter: whimboo, Unassigned)




(Whiteboard: [triaged])

I'm maintaining an add-on called memchaser which can be used to track the current memory usage of Firefox, and if necessary trigger a garbage collection. Given that it is using XPCOM interfaces it will die with Firefox 57 because there is no API for webextensions yet. 

I would like to request the addition of the following XPCOM interfaces for webextensions:
* nsIMemoryReporterManager.residentFast
* nsIMemoryReporterManager.minimizeMemoryUsage()
* nsIDOMWindowUtils.cycleCollect()
* Component.utils.forceGC() (

Here the source of the add-on:

The code is also relying a lot on observer notifications. So not sure if those would work too, but that is most likely another topic.

I think adding a memory API and permission to access the memory reporting probably makes sense. I'm a bit leery about exposing forceGC/forceCC, though... I suspect add-ons are more likely to abuse it rather than use it for legitimate purposes.

It seems like this would be best as a devtools API, but those are generally only available from devtools panels, which might not be great for your use case. Maybe we can come up with some other way to discourage non-developers from using it, though.

Andrew, do you have any thoughts on this?
Flags: needinfo?(continuation)
I understand your concern about forceGC/forceCC, but I think it is mostly harmless in practice. I don't know how useful it actually is, though. Somebody can trigger GC and CC from about:memory if they really want to, but it isn't something you'll be doing all of the time.
Flags: needinfo?(continuation)
The reporting has clearly the highest priority for me. If forcing a GC/CC is not something we want or can support, it's fine. As Andrew said, it can still be done through about:memory.
andy commenting, open/interested
Flags: needinfo?(amckay)
Priority: -- → P3
Just wanted to say this seems like a good API to do. It should probably go behind a permission and be an Experiment. Given that the add-on already exists, it sounds like its a matter of translating the add-on into an experiment and trying it out. Or maybe just land into Firefox directly. Henrik, would this be something you'd have the time to take on?
Flags: needinfo?(amckay)
Whiteboard: [triaged]
Believe me I would really be interested to do so. But my time is more than limited right now and the next months. So I doubt I will be able to help out to create such an experiment webextension. Sorry.
See Also: → 1296898
Product: Toolkit → WebExtensions
Closed: 5 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.