Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Microsoft releases Free JavaScript Leak Detector

DZone's Guide to

Microsoft releases Free JavaScript Leak Detector

· Web Dev Zone
Free Resource

Add user login and MFA to your next project in minutes. Create a free Okta developer account, drop in one of our SDKs to your application and get back to building.

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.

 

Launch your application faster with Okta’s user management API. Register today for the free forever developer edition!

Topics:

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}