Information heap size

Rick Hoving picture Rick Hoving · Jan 20, 2014 · Viewed 7.3k times · Source

What information can I obtain from the performance.memory object in Chrome?
What do these numbers mean? (are they in kb's or characters)
What can I learn from these numbers?

Example values of performance.memory

MemoryInfo {
  jsHeapSizeLimit: 793000000,
  usedJSHeapSize: 10000000,
  totalJSHeapSize: 31200000
}

Answer

Bergi picture Bergi · Jan 20, 2014

What information can I obtain from the performance.memory object in Chrome?

The property names should be pretty descriptive.

What do these numbers mean? (are they in kb's or characters)

The docs state:

The values are quantized as to not expose private information to attackers.

See the WebKit Patch for how the quantized values are exposed. The tests in particular help explain how it works.

What can I learn from these numbers?

You can identify problems with memory management. See http://www.html5rocks.com/en/tutorials/memory/effectivemanagement/ for how the performance.memory API was used in gmail.