On 07/01/2013 01:06 PM, Gareth Aye wrote:
Hi B2G,
I asked on IRC before, but I think maybe none of the webapi folks were
around so I'll mirror my question here. Are there any gecko apis that apps
can use to
1. ask how much memory they're using or
2. get notified when they're using more than a certain amount of memory?
AFAIK, there is no such API.
To be honest I think this is not the greatest way to address the problem.
JavaScript nor the DOM are providing any way to inspect the memory usage of
its components. In addition, the memory usage of each component is subject
to changes.
In addition to that, if a platform is loaded or small, the system might only
have a few MB to allocate to your application.
Thus having an hard-coded limit sounds like a bad solution to me.
In addition to that, such magicAPI would imply that the we are able to
isolate the memory within a subset of a compartment, which is fine as long
as the subset does not hold references on something created else-where.
Then the same question can be ask on where the DOM belongs.
From what I saw, the only working solution to deal with memory management
in Web pages is the suggestion that Vivien Nicolas made recently. His
proposal was to use sand-boxed iframes to prevent cross-compartments and to
manage the memory by re-locating the iframes or letting the discard choice
to Gecko.
If needed we can suggest a way to mention that some iframes should be
collected first with a relative ordering, but not providing an absolute
value when the web is supposed to run everywhere.
--
Nicolas B. Pierron
_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g