Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Odd console.memory results in Chrome, negative numbers in timeline memory dev tools, a Chrome bug?

After running for a very long time (a day or more) a web-based app I wrote (JS/HTML5) starts acting "weird". Primarily it stops sending the normal data it should to the backend, where I expect it to be sending ~500kb of data it starts sending just a few bytes of nonsense. I suspected this was memory related (unable to allocate memory or something?) and when I investigated I saw something truly strange and seemingly impossible, which suggests to me that it's a Chrome bug I'm encountering perhaps through high memory usage. But I could use some confirmation from someone who knows better than I do.

The main oddness seems to be what console.memory spits out. The linked document says that "usedJsHeapSize can not be greater than totalJsHeapSize" which it very, very much is. It's also higher than the heap size limit, which I imagine it should not be:

Results of console.memory call

I then tried to see what devtools might tell me and did a timeline of memory at that instant, for a few seconds, and look at what it says.... the memory ranges from some negative insanely big number to 0B. That sure doesn't seem right.

Timeline of memory usage

And I checked the chrome://memory report and while it is using a lot of memory, comparing that to other Chrome browsing sessions I have going it doesn't seem freakish.

chrome://memory

Can anyone confirm this is a Chrome bug versus expected dev tools behavior I'm not interpreting correctly.

Thanks!

like image 916
Quinxy von Besiex Avatar asked Apr 12 '14 03:04

Quinxy von Besiex


People also ask

How do I view Console errors in Chrome?

In Chrome, navigate to View > Developer > JavaScript Console or More Tools > JavaScript Console or press Ctrl + Shift + J. The error console will open. If you don't see any errors try reloading the page. The error may be generated when the page loads.

What is shallow size and retained size in Chrome?

Shallow and retained size This gives rise to a distinction between two ways to look at the size of an object: shallow size: the size of the object itself. retained size: the size of the object itself, plus the size of other objects that are kept alive by this object.


1 Answers

  • Values are bucketed to prevent side-channel attacks
  • Bucketing described here: http://goo.gl/fFspKO
  • Get precise numbers with Chrome flag: --enable-precise-memory-info
like image 97
Darius Avatar answered Oct 14 '22 16:10

Darius