memory

< apis
Jump to: navigation, search

performance.memory

This article is Not Ready.

Non-Standard

Summary

Do not use. Proprietary. Chrome only. Gets quantized scripting memory usage numbers.



Property of apis/timing

Syntax

Note: This property is read-only.

var memoryInfo = window.performance.memory;

Return Value

Returns an object of type Object

An object created with MemoryInfo constructor, containing jsHeapSizeLimit, totalJSHeapSize and usedJSHeapSize properties with numerical values.

Examples

JavaScript

console.log(performance.memory)

// Would show, for example
//{
// jsHeapSizeLimit: 767557632,
// totalJSHeapSize: 58054528,
// usedJSHeapSize: 42930044
//}

Notes

usedJsHeapSize is the total amount of memory being used by JS objects including V8 internal objects, totalJsHeapSize is current size of the JS heap including free space not occupied by any JS objects. This means that usedJsHeapSize can not be greater than totalJsHeapSize. Note that it is not necessarily that there has ever been totalJsHeapSize of alive JS objects.

The values are quantized as to not expose private information to attackers. If Chrome is run with the flag `--enable-precise-memory-info` the values are not quantized.


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

Attribution

This article contains content originally from external sources.

Portions of this content come from the Microsoft Developer Network.