Performance: memory property
Deprecated
Avoid using this feature in new projects. This feature may be a candidate for removal from web standards or browsers.>
Non-standard: This feature is not standardized. We do not recommend using non-standard features in production, as they have limited browser support, and may change or be removed. However, they can be a suitable alternative in specific cases where no standard option exists.
The non-standard and legacy memory read-only property returns the size of the JavaScript heap which can be helpful to measure and reduce the memory footprint of websites.
Note that the information this API provides is unreliable as it might overestimate actual memory usage if web pages share the same heap, or might underestimate actual memory usage if web pages use workers and/or cross-site iframes that are allocated in separate heaps. It is not standardized what "heap" means exactly. The API is only available in Chromium-based browsers.
A new API aiming to replace performance.memory is Performance.measureUserAgentSpecificMemory(). It tries to estimate the memory used by a web page.
Value
Returns an object with the following properties:
jsHeapSizeLimit-
The maximum size of the heap, in bytes, that is available to the context.
totalJSHeapSize-
The total allocated heap size, in bytes.
usedJSHeapSize-
The currently active segment of JS heap, in bytes.
Examples
>Getting JavaScript heap sizes
Calling performance.memory returns an object like this:
{
"totalJSHeapSize": 39973671,
"usedJSHeapSize": 39127515,
"jsHeapSizeLimit": 4294705152
}
Specifications
None.