Information heap size

与世无争的帅哥 提交于 2019-12-05 06:07:06

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.

The related API documentation does not say, but my read judging by the numbers you shared and what I see on my machine is that the values are in bytes.

A quick review of the code to which Bergi linked - regarding the values being quantized - seems to support this - e.g. float sizeOfNextBucket = 10000000.0; // First bucket size is roughly 10M..

The quantized MemoryInfo properties are mostly useful for monitoring vs. determining the precise impact of operations on memory. A comment in the aforementioned linked code explains this well I think:

86 // We quantize the sizes to make it more difficult for an attacker to see precise
87 // impact of operations on memory. The values are used for performance tuning,
88 // and hence don't need to be as refined when the value is large, so we threshold
89 // at a list of exponentially separated buckets.

Basically the values get less precise as they get bigger but are still sufficiently precise for monitoring memory usage.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!