3

Using window.performance.memory.usedJSHeapSize, I am attempting to monitor the memory consumption of my web application in real time.

There is a large discrepancy between the value returned by the performance API and the value the Chrome Timeline shows that I do not understand.

At application start both are about 20mb.

After some navigating around meant to detect a memory leak, Chrome Timeline shows much more usage (say, 150mb), and window.performance.memory.usedJSHeapSize changes very slightly (say, 20.69mb).

Is this value measuring something different than I think it's measuring? Why the discrepancy?

SimplGy
  • 20,079
  • 15
  • 107
  • 144
  • The OP of another question notices the same discrepancy in a comment, but does not explain the cause: http://stackoverflow.com/questions/18455644/programatically-get-memory-usage-in-chrome?rq=1 – SimplGy May 22 '14 at 01:16
  • the timeline includes images, css rules, cache, layout caches, etc... – dandavis May 22 '14 at 02:22
  • That's a start... Does the JS Heap Size include DOM nodes? In this application we know that we are leaking them. The way I understand the model, an implicit link to a native DOM node object is created when I assign a dom node to a variable. That reference stays around until I dereference the variable. I don't know if that dom node is included in the JS Heap reported. – SimplGy May 22 '14 at 05:35
  • afaik, there are no dom nodes in js heap numbers, it's just the value from V8. some events or dom bindings may require js heap space, but html needs no js. use the chrome task manager (SHIFT+ESC) to keep an eye on all the memory usage by category, making sure to right-click the grid and select far more columns than the default. also, don't worry about runaway non-js ram usage, chrome likes to do that just as linux likes to use up all your ram for cache... – dandavis May 22 '14 at 06:06

0 Answers0