Reading the Snapshot Summary View
You'll learn how to interpret the four essential columns in a heap snapshot to understand what's consuming memory in your application.
Understanding the Summary View Layout
After taking a heap snapshot in DevTools, the Summary view presents objects grouped by their constructor. This table shows four critical columns that reveal different aspects of memory usage:
Constructor Column
This shows the constructor function or type that created the objects (like Array, Object, HTMLDivElement, or your custom class names). Objects are grouped by their constructor, making it easy to see how many instances of each type exist.
Distance Column
This represents how far an object is from the GC root in the reference chain. Think of it as "degrees of separation" — a distance of 1 means the object is directly referenced by a root, while higher numbers indicate more intermediate references. Objects with very high distances might be held by long reference chains you weren't expecting.
Shallow Size Column
This is the memory the object itself directly occupies — just its own properties and structure. For an array, this includes the array structure but not the objects it references. It's like measuring just the weight of a backpack, ignoring what's inside.
Retained Size Column
This shows the total memory that would be freed if this object were garbage collected — including everything it keeps alive. This is the backpack plus everything inside it. High retained sizes indicate memory bottlenecks — these objects are holding onto substantial resources.
Reading the Data
Look for constructors with unexpectedly high counts, large retained sizes, or unusual distance values. These often point to leaks or inefficient data structures.
Key Takeaway: The Summary view's four columns work together — Constructor tells you what, Distance shows reachability depth, Shallow Size measures direct footprint, and Retained Size reveals total impact on memory.