Please add support for memory reporters

NEW
Unassigned

Status

()

Toolkit
WebExtensions: Experiments
P3
normal
a year ago
5 months ago

People

(Reporter: whimboo, Unassigned)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(firefox55 affected)

Details

(Whiteboard: [triaged], URL)

(Reporter)

Description

a year ago
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:

https://github.com/mozilla/memchaser/blob/master/extension/lib/memory.js:
* nsIMemoryReporterManager.residentFast
* nsIMemoryReporterManager.minimizeMemoryUsage()

https://github.com/mozilla/memchaser/blob/master/extension/lib/garbage-collector.js:
* nsIDOMWindowUtils.cycleCollect()
* Component.utils.forceGC() (

Here the source of the add-on:
https://github.com/mozilla/memchaser/

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.

Thanks
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)
(Reporter)

Comment 3

a year ago
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.

Comment 4

a year ago
andy commenting, open/interested
Flags: needinfo?(amckay)
Priority: -- → P3

Comment 5

a year ago
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]
(Reporter)

Comment 6

a year ago
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.

Updated

9 months ago
See Also: → bug 1296898
You need to log in before you can comment on or make changes to this bug.