Information heap size
Asked Answered
I

2

6

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
}
Ilan answered 20/1, 2014 at 16:0 Comment(3)
Have you checked the docs?Bernettabernette
@Bernettabernette of course I have :-), although it explains what the metrics are . It doesn't state the measurements of these metrics (e.g. kb's or what else?)Ilan
My question is, what can I use the data for. What is their usage.Ilan
B
8

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.

Bernettabernette answered 20/1, 2014 at 16:19 Comment(0)
T
3

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.

Triturable answered 20/1, 2014 at 16:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.