I'm building an app in javascript and I would like to use console.log to preview everything that is on memory at runtime. I know I can check each variable selectively, but: is there a way to see everything?
Thankyou.
I'm building an app in javascript and I would like to use console.log to preview everything that is on memory at runtime. I know I can check each variable selectively, but: is there a way to see everything?
Thankyou.
Install Firebug on Firefox. From there you can click on DOM and see all declared javascript variables. There's also an arrow on it that allows you to specify the source of the variables you would like to see such as "only user-defined properties" etc etc. Hope that helps you. (You could also console.log
the window
object as it contains everything)
.... EDIT .... After Josh's comments, I decided to take a look if any browser provided the power to actually look at the entire memory at a given time and Chrome's developer tools does exactly what your want. Simply start the developer tool - click 'Profiles' - then press the 'eye' icon in the bottom left and you'll get an entire collection of all things currently in memory (including items within closure). Hope this helps, your question has wound up helping me :)
For Google Chrome, there is Developer Tools, in which you can go to the Profiles tab to get a heap snapshot. The nightly Chromium builds seem to have a more detailed preview of memory usage than the current stable version of Google Chrome.