> 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?

We have (1), but not really (2).

Gecko keeps a fairly detailed breakdown of its memory usage, but the
main consumer of this information is about:memory, so it's not
necessarily easy for others to make sense of it.

But if all you want to do is measure the total memory usage of the
current process (every app gets its own process), that's very easy:
Just read nsIMemoryReporter::resident.

> I ask because we have a couple bugs in calendar that can be generalized to
> "When we do X we use more than Y memory" and I want for us to be able to
> write tests like https://gist.github.com/gaye/5903408 before we begin
> plugging away optimizing our memory usage so that our memory usage related
> bug fixes get codified tests just like our functionality related bug fixes.

Are you thinking of structuring these as automated tests?  That's an
interesting idea, but it might be pretty fiddly, since unrelated Gecko
changes could regress your tests.

It might be better to continue this discussion in the context of a bug
(or a metabug).  If you put [MemShrink] in the whiteboard, you'll
bring the bug to the attention of a group of us who deals with these
sorts of issues, but feel free to cc me separately.

-Justin
_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g

Reply via email to