First of all, sorry for neglecting that bug! And +1 on this suggestion.
How does one write a memory reporter that captures data stored on more than just the main thread? In the case of Web Audio for example, some of our buffers live in another thread, and as far as I can see the memory reporter API is mostly synchronous. Is locking the right way to do this?
Thanks! Ehsan On 12/16/2013, 10:57 PM, Nicholas Nethercote wrote:
Hi, For over a month I've been working with a user to identify the cause of a bad memory leak (https://bugzilla.mozilla.org/show_bug.cgi?id=936784). Just today we got DMD working sufficiently well on Windows that the user was able to run it, and it pointed the finger at webaudio. Which is great progress! But if we had memory reporters for web audio, all this would have been so much easier. And (queue sad-face) we actually have a six-month old bug open for that: https://bugzilla.mozilla.org/show_bug.cgi?id=884368 So I want to propose something: if you're working on a change that will introduce significant new causes of memory consumption, you should write a memory reporter for it at the same time, rather than (maybe) doing it later, or letting someone else do it. And in this context, "significant" may be smaller than you expect. For example, we have numerous reporters for things that are typically only 100s of KBs. On B2G, 100KB per process is significant. Understanding the data structures is usually the hard part of writing a memory reporter. The actual reporter registration side isn't hard, and there are plenty of examples to refer to. So the author of the new code is typically the best person to write a reporter for it. And I'm happy to help (and review). Furthermore, memory reporters are best verified by doing a DMD run, and DMD now runs on all tier-1 platforms and is well documented (https://wiki.mozilla.org/Performance/MemShrink/DMD). So that shouldn't be an obstacle. This couldn't be a hard-and-fast rule, but I would like for it to be something that developers and reviewers keep in mind -- Does this code need a memory reporter? And have you verified it with DMD? Thoughts? Nick p.s.: The web audio bug prompted me to make this suggestion, and is a good example of the potential benefits. But I don't mean to criticize those who implemented web audio; apologies if it comes across that way. In that spirit, let's keep discussion on the general proposal as much as possible, rather than web audio. Thanks! _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform
_______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform