Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to check ram consumption javascript

I need to improve the performance of a script done in Javascript, and I can check the RAM consumption script said.

for example like the PHP function get_memory_get_peak()

like image 800
rkmax Avatar asked Oct 22 '11 17:10

rkmax


3 Answers

In Chrome, if you run with the --enable-memory-info flag, you can get the data from:

console.memory;

which contains:

jsHeapSizeLimit
totalJSHeapSize
usedJSHeapSize

This data can also be fetched from a memory heap snapshot by pressing F12, but this is not programmatically.

like image 196
pimvdb Avatar answered Nov 06 '22 05:11

pimvdb


The Chrome developer tools include a heap profiler: http://code.google.com/chrome/devtools/docs/heap-profiling.html

like image 44
millimoose Avatar answered Nov 06 '22 06:11

millimoose


You cannot read memory data using JavaScript code. A method to see the memory consumption is by inspecting the process.

Chrome has a built-in statistics screen, which can be summoned using Shift + Esc. This screen shows various information about each tab, including memory consumption.

like image 40
Rob W Avatar answered Nov 06 '22 05:11

Rob W