Reputation: 18125
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()
Upvotes: 6
Views: 5769
Reputation: 154818
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.
Upvotes: 12
Reputation: 348962
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.
Upvotes: 3
Reputation: 1
You could format the PHP code with CSS & JS, but that's about it. Use the PHP Function, and HTML can't do that, it's just a markup language.
<?php
print(get_memory_get_peak());
?>
Try using the Task Manager, go to processes, and check the usage stats!
Upvotes: -8
Reputation: 39950
The Chrome developer tools include a heap profiler: http://code.google.com/chrome/devtools/docs/heap-profiling.html
Upvotes: 3