DevTools/Memory/Roadmap
Overview
We want to ship memory tools built-in to the Firefox Developer Tools for web and firefox developers to identify, locate, and resolve memory issues related to memory bloat and leaks. If the memory tool can inform, educate and empower developers in each of these 3 stages, then we believe that this tool will successfully solve memory bloat and leak.
The platform work for the memory tool was started in 2014, with initial requirements gathering and work on the memory APIs. At the time of writing (April 2015), we now flesh out the use-cases and requirements on the front end experience.
Tool Stages
Stage 1: Identify
Stage 2: Locate
Stage 3: Resolve
Users/Use Cases
Web Developers
Framework Developers
Gecko Developers
Requirements
TODO
Technical Requirements
Platform Work
TODO
Background
Platform work started in early 2014 — at the time of writing (April 2015), here’s some background on that work done.
Front End Work
Design
Timeline/Milestones
- Requirements: Mid Q2
- Ship: Mid Q3
Evaluation Metrics
Feature Description
A collection of feature descriptions referenced in the prior art, as well as requirements. These are features common in many other memory tools, to establish terminology used, not necessarily for implementing in the Firefox memory tools.
Overview View
This is different in every tool, but usually a high level look at a heap snapshot, able to be sorted by class/type/allocation site/module, etc., with allocation counts, size, overall memory consumption, and a first step to discovering where a memory issue is hiding.
Dominator View
A view showing which objects dominate other objects. In OptimizeIt, this is known as a reduced reference graph.
Paths View
A view showing, from the GC root, a path of object references leading to the object in question.
Force GC
Utility to force garbage collection.
Leak Detection
This is pretty different in each tool, if it exists. Usually a smart analysis with some heuristics to point the developer to a potentially leaky object.
Heap Diffs
View that compares the difference between two heaps, usually showing difference in size and class counts of objects.
Allocations By Stack
A stack view with allocations performed in each frame — similar to the current Firefox Developer Tools performance allocation view.
Allocations By Time/Type
A slice of allocations that occurred in a timerange, able to view by type (like an overview), like Chrome’s allocation timeline.
Prior Art
There are many other memory profiling tools out there; when researching this, we look at not only other browser developer tools, but also other environments’ tooling, like Java. Many of the tools contain many of the same features, listed below in the overview graph, with unique features for each product explained after.
Comparison
Tool | Overview | Dominator View | Paths View | Force GC | Leak Detect | Heap Diffs | Allocs by stack | Allocs by time/type |
---|---|---|---|---|---|---|---|---|
YourKit Java Profiler | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
Eclipse MAT (tut) | ✓ | ✓ | ✓ | ✓ | ✓ | |||
Borland OptimizeIt | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
Chrome DevTools | ✓ | ✓ | ✓ | ? | ✓ | ✓ | ||
IE11 DevTools | ✓ | ✓ | ✓ | ✓ | ||||
VS2015 | ✓ | ✓ | ✓ | ✓ |
YourKit Java Profiler
- Can snapshot on high memory load
- Has a Merged Paths view, that’s similar to path from GC view, but does not show path of individual objects, but shows paths from multiple objects grouped by class.
- Has “incoming references” view, inverse of references.
- Has automation inspection view, which highlights potential memory issues. Not sure what all this provides, but looks like a good “coach” for memory issues.
- Has GC view showing times of GC, length of GC, and GC in the context of a call tree
Eclipse MAT
- Histogram tool (overview), dominator view, path to GC, etc.
- leak hunter tool
- Interested SQL-like query for the heap.
- Seems like a very complicated heap diff mode.
Borland OptimizeIt
- The paths view (reference graph) can be inverse (outgoing reference graph)
- Allocation Backtrace - Can view any class/type of object and list all allocation sites for that type, sorted by number
- Aggregated Graph View - A graph visualization of the call stack, with each node being a frame, with red nodes indicating the frame allocates objects (the more saturated the red, the more allocations in this frame)
- Can disable GC.
Chrome DevTools
- Has summary view (overview), diff two snapshots in comparison view, path view via containment view, and a dominator view in the heap snapshot profiler.
- Has a heap allocations timeline that displays allocation pressure, color coding whether or not the objects are still alive at the current time (or at the end of the recording). Uses the same views as the memory profiler to compare the heap snapshots during the timeline.
- Chrome Timeline can record memory usage over time (by very high level type).
- Does not have explicit GC — but GC’s on memory snapshot. Timeline tool has a force GC, however.
IE11/VS2015
- Seem to be based on the same infrastructure.
- Caller/callee mode (inverting), like incoming/outgoing reference paths.
- “Just my Code” (VS2015) and “Show built-ins” (IE11), a way to hide platform data.
- Toggleable ability to display circular references
- VS2015 - can set a threshold line in memory timeline — great for a “memory emulator” feature?
- Very beautiful overview page showing diffs in heap snapshots during the timeline recording.