Over a million developers have joined DZone.

Microsoft releases Free JavaScript Leak Detector

· Web Dev Zone

Paoli Severini from Microsoft's Global Product Development Team has released a tool called JSLeaks Detector which facilitates finding memory leaks in Internet Explorer. Several articles have been published on how circular references occur in Internet Explorer and how to avoid them. However, this requires the developer to be constantly on guard and even the most seasoned developers slip up at times. This will allow a simple way to test your pages for memory leaks and be aware of when you are leaking memory.

[img_assist|nid=478|title=JSLeaks Detector screenshot|desc=|link=none|align=none|width=699|height=189]


A basic memory leak (in IE 6) as shown on the release page:
<html>
<head>
<script language="JScript">
var jsObject;
function SetupLeak()
{
jsObject = document.getElementById("LeakedDiv");
document.getElementById("LeakedDiv").expandoProperty = jsObject;
}
</script>
</head>
<body onload="SetupLeak()">
<div id="LeakedDiv"></div>
</body>
</html>


Here the SetupLeak() function creates a circular reference which will leak in IE 6.
Circular Reference

The tool installs as a plugin to Internet Explorer 6 and 7 under both Windows XP and Vista. It will be interesting to see if any of the techniques used by Microsoft will be picked up by other IE memory leak tools like sIEve and Drip.

 

Topics:

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}