I'd like to know how much memories are used during a single function call, what should I do?
I'm not developing in node.js environment, so it would be better to know if there's anyway to do it in plain vanilla js.
I'd like to know how much memories are used during a single function call, what should I do?
I'm not developing in node.js environment, so it would be better to know if there's anyway to do it in plain vanilla js.
Chrome dev tools have excellent tools to monitor both performance and memory used. Hit 'F12' and check the 'Performance' and 'Memory' tabs.
The "Record allocation profile" option should show memory allocations from your javascript functions.
You can also follow this article on a how to step by step tutorial.
This falls in the category of "manually" though, not programmatically but it could still be helpful.
Paul Irish has also released memory-stats.js, which I guess can be used to measure memory allocated by the Javascript engine but in no way you can corelate it to a function in specific.