I have to test memory usage of some pages in Chrome on Windows programmatically.
Here is my Chrome version (60.0.3112.113 - Official Build - 64-bit)
Following Chromium Command Line Switches Documentation I ran Chrome with --enable-precise-memory-info
flag:
Then in the opened Chrome instance I tried to check value of window.performance.memory.usedJSHeapSize
but looks like inspite of --enable-precise-memory-info
flag this info is still bucketized.
even in Chrome Task Manager (Shift + Esc) I see that memory usage is grows up by about 1 Mb after each execution of:
for(let i=0;i<100000;i++) {a.push('sdftgkljhghertyukytedtreut56ytirty7uikty' +i)}
I found only one outdated discussion concerning this issue even if the issue exists I would expect to find more discussions online.
If I do something wrong - what is my mistake?
If this flag is not supported anymore then what is the new correct way to do it?
Thank you!
I have to test memory usage of some pages in Chrome on Windows programmatically.
Here is my Chrome version (60.0.3112.113 - Official Build - 64-bit)
Following Chromium Command Line Switches Documentation I ran Chrome with --enable-precise-memory-info
flag:
Then in the opened Chrome instance I tried to check value of window.performance.memory.usedJSHeapSize
but looks like inspite of --enable-precise-memory-info
flag this info is still bucketized.
even in Chrome Task Manager (Shift + Esc) I see that memory usage is grows up by about 1 Mb after each execution of:
for(let i=0;i<100000;i++) {a.push('sdftgkljhghertyukytedtreut56ytirty7uikty' +i)}
I found only one outdated discussion concerning this issue even if the issue exists I would expect to find more discussions online.
If I do something wrong - what is my mistake?
If this flag is not supported anymore then what is the new correct way to do it?
Thank you!
Share Improve this question edited Oct 11, 2018 at 20:45 Dawid Zbiński 5,8268 gold badges50 silver badges76 bronze badges asked Sep 17, 2017 at 13:38 AlexanderAlexander 7,8624 gold badges55 silver badges67 bronze badges 7- Er, actually it sounds like a bug worth reporting on crbug. – woxxom Commented Sep 17, 2017 at 14:26
- @wOxxOm Good idea. I've opened a new issue there: bugs.chromium/p/chromium/issues/detail?id=765998 – Alexander Commented Sep 17, 2017 at 17:03
- @Alexander Was an instance of Chrome open when you launched second instance of Chrome with flag set? – guest271314 Commented Sep 18, 2017 at 2:07
- @guest271314 Thank you. Yes, I closed all the instances and even checked in Task Manager that there is no any Chrome process running. But I still see the same behavior. – Alexander Commented Sep 18, 2017 at 9:05
-
1
@Alexander Cannot reproduce at Chromium 60. Have you tried launching with
--user-data-dir
set to a different directory than default Chrome configuration folder? – guest271314 Commented Sep 18, 2017 at 9:05
3 Answers
Reset to default 2I didn't find the reason why --enable-precise-memory-info
doesn't work, so any help with that will be appritiated.
Meanwhile I found another way to do it even and I decided to share it.
I created a chrome extension and added a listener for chrome.processes.onUpdatedWithMemory
in its background.js.
It gives me updated information concerning chrome processes including memory usage (the privateMemory
field), but this solution has two problems:
- To use chrome.processes I have to run the extension on Dev channel only.
- Collecting memory usage information this way incurs extra CPU usage.
In Chrome 68+ you can now sample once every 50ms for scripts served from the same origin as the webpage (eTLD+1). This means you probably don't need --enable-precise-memory-info
anymore.
https://chromium.googlesource./chromium/src/+/7c7847f69de403f6c798dfccba10812039a60480
maybe you need to close all opened chrome window (cmd + q) before run /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --enable-precise-memory-info