Javascript:SpiderMonkey:HeapProfiling
From MozillaWiki
Firefox should provide tools that web developers can use understand how their JavaScript code uses memory. Different analyses expose different aspects of the code's behavior:
- What is my page spending memory on? Tools should show what portion of the page's memory usage each kind of object comprises. The tools should categorize objects by type, by prototype, and by the location of the JavaScript code that allocated them.
- When does allocation occur? Tools should show how much allocation each portion of JavaScript code is responsible for.
- How much memory does this entire data structure consume? By analyzing patterns of reference between objects, tools can show how much memory specific portions of the object graph consume.
- Why is this particular object still alive? Tools should help developers find labeled paths from objects known to be live (say, the
window
object) to specific objects that the developer expected to be unreachable, but has learned (perhaps through the other tools) are still alive.
We are still researching what sorts of tools would be most valuable, how best to collect the data, and how to present it effectively.
There exist Firefox plugins, based on internal heap tracing APIs, which Mozilla developers use to track down memory leaks, but these require familiarity with Firefox's internals to use.