Open Bug 813530 Opened 12 years ago Updated 1 year ago

Add low memory event for JS content

Categories

(Core :: DOM: Core & HTML, enhancement)

enhancement

Tracking

()

People

(Reporter: jgilbert, Unassigned)

References

(Blocks 1 open bug)

Details

(Whiteboard: [games:p?])

I could be very useful to web apps to know when we are using too much memory, such that we're at risk of being killed.

One idea is to provide a 'low memory' event via a JS page event, which could allow an app to free any spare memory and/or scale back its memory usage. An app could unlink spare objects it doesn't need anymore. After returning from this event, JS could GC/CC (as normal for memory pressure events, I think) to free whatever memory the page could spare.

With this API, a page would be able to respond to dangerous levels of memory use. Currently, if an app uses a lot of memory on mobile, it risks the OS axing the browser for using too much memory.
Whiteboard: [games:p?]
Yeah, good idea; we already have some of the data, so we should be able to expose it to web apps.  Useful for more than just games, too.
Whiteboard: [games:p?] → [games:p2]
Blocks: gecko-games
It'd be good to check with other browsers on standard mailing-lists before proceeding.
The WHATWG mailing list sounds like a good fit for this sort of feature.
http://lists.whatwg.org/listinfo.cgi/whatwg-whatwg.org
Low memory notifications would also be useful for B2G apps.
Whiteboard: [games:p2] → [games:p?]
Severity: normal → S3
Component: General → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.