Possible Duplicate:
JavaScript object size
How to measure memory usage and efficiency?
I guess the answer is probably "You can't", but is there any way to see how much memory is allocated to each object in the DOM/javascript environment? What tools are there and does it vary from browser to browser?
If the answer is indeed "You can't" can anyone explain why not?
Memory spaces in V8 “Variables in JavaScript (and most other programming languages) are stored in two places: stack and heap.
How many bytes is a JavaScript object? 64 bits are 8 bytes, but each number actually takes up an average of 9.7 bytes. Likewise, Chrome shows the size of each individual empty array as 32 bytes and the size of each empty object as 56 bytes.
JavaScript engines have two places where they can store data: The memory heap and stack. Heaps and stacks are two data structures that the engine uses for different purposes.
Using Chrome, you can use their developer tools (CTRL + SHIFT + I or F12). Click on the Profiles tab and press the eyeball icon in the status bar.
My versions of Safari and IE8 also have profiling tools, but for CPU only, not memory usage.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With