Measuring JavaScript Heap
To have access to the JavaScript runtime heap open Chrome with the following flag:
open /Applications/Google\ Chrome.app/ --args -enable-memory-info
After doing so, you have access to the JavaScript heap:
// currently used heap
window.performance.memory.usedJSHeapSize;
// total heap
window.performance.memory.totalJSHeapSize;
Found this very interesting to play around with. More detailed information can be found here: http://buildnewgames.com/garbage-collector-friendly-code/
Written by Jonathan Krause
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Performance
Authors
Did you know?
JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.
Security insights from Cside
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#