Browser troubleshooting

Distinguish JavaScript heap from total browser memory

JavaScript heap measurements cover only part of a browser’s resource use. Images, native objects, graphics buffers, and other processes can make total browser memory very different from a page’s heap figure.

Worked example

Browser console example · use a disposable page on your own site

if ("memory" in performance) {
  console.log("Reported JS heap bytes:", performance.memory.usedJSHeapSize);
} else {
  console.log("This browser does not expose this nonstandard heap metric");
}

How it works

The feature check prevents code from assuming every browser implements performance.memory. A heap value can help with controlled JavaScript diagnostics, while a browser task manager or operating-system tool reports a different scope. Always label the measurement and unit.

Limits and mistakes

Performance.memory is nonstandard and deprecated, and its values can be incomplete or misleading. Do not turn it into a cross-browser score. It does not report installed RAM or necessarily account for every memory allocation associated with the page.

Check the result

Confirm whether the API is exposed in your browser. Compare repeated measurements within the same scope, and document unsupported browsers instead of substituting a fabricated zero.

Sources

Reference documentation for the behavior used in this guide: