Read through for a post bonus: A link to my first ever web site.

Since its release in the mid-1990s, JavaScript has taken on an important role in web site and application development. These days, you would be hard pressed to find a site that doesn’t make extensive use of it for natively generating rich and interactive user interfaces in your browser.

So it’s about time Visual Studio started to play nice with JavaScript. Microsoft made some huge strides to aid JavaScript development in Visual Studio 2012, including improved IntelliSense, fully-functional breakpoints (finally!) and comprehensive debugging features.

The power of JavaScript has really been unchecked since its inception… It’s awfully easy to consume a lot of memory, force an unbreakable endless loop, and even crash a browser with a few lines of JavaScript code. To fully illustrate this, I’ll take you back to the 1990s and my first ever web site, published on Geocities. I built a JavaScipt memory eater program, prominently available via a clickable “BEWARE” button. Pretty bad that a 13-year-old kid can create a script that crashed friends’ browsers (and entire AOL and Prodigy sessions as I recall). Anyway, if as a teen I was aware of the power of it, that just illustrates the high visibility of bad JavaScript memory consumption.

In Visual Studio 2012 Update 1, Microsoft introduced a new feature, the JavaScript Memory Analyzer. This tool helps you understand and monitor memory usage in your JavaScript code. You can attach the analyzer to your app and get a diagnostic summary of memory usage. This isn’t just limited to your source code–you can attach it to other apps running on your machine, even if you don’t have the source code running in Visual Studio.

Note that this tool is currently only available for Windows Store apps built using JavaScript via Visual Studio 2012 Update 1, running on Windows 8. Here’s to hoping they expand the usage to all the platforms… I can think of a few sluggish web applications I’m interested to see a memory analysis on…

js-analysis-overview

js-analysis-overview2

For more information on the JavaScript Memory Analyzer, see the MSDN article Analyzing memory usage data (JavaScript).

For a laugh, go back in time and visit an archive copy of my first ever web site on the Internet Archive Wayback Machine.  While my original memory eater program is no longer a danger to current browsers, a modern variant based on it (that I just created) still manages to crash my entire computer within about 10 seconds of execution. For the sake of security, I won’t post that code ;)

Like this post? Share it!