#131 new
David Blavier

Memory leak in Ajax.Autocompleter with IE6

Reported by David Blavier | December 4th, 2008 @ 03:15 PM

We found several memory leaks in Ajax.Autocompleter when used within IE6. We found those using the Drip tool ( http://www.outofhanwell.com/iele... )

You will find in the attached files a test case that shows leaking. Try running it with drip, type "A", select a band, re-type "A", click on "show dom leaks".

The leak comes from listeners attached to DOM objects (using Event.observe) that aren't properly removed using Event.stopObserving). Such things shouldn't usually be done in other browsers, but since ie6 use reference counting on its DOM objects, most memory leaks come from attached events, at least that's how we solve most of our ie6-javascript memory leaks in our software product.

I've modified the file "controls.js" to correct the leak, by introducing two methods : - addObserver: function(element, type, listener) : which calls Event.observe (element, type, listener) and registers a disposer functor. - dispose: function() which executes all disposer functors. My solution is a bit intrusive, since it requires the user of the control to explicitely call dispose (); This solution fits our needs, since we already have the notion of "javascript destructors" that are called on the age "unload" event in our software product. Feel free to include our patch, or to modify it to your needs.

Here are attached 2 files : - controls-js.patch : my patch against scripaculous release 1.8.3. - test-leak.zip : a simple test case showing the leak -- test.html : which make use of the original version. -- test-using-patch.html : which make use of the original version. -- controls.js : original controls.js -- controls-patched.js : controls.js patched by me. - drip.png : a screenshot of the memory leaks drip found.


Florent Le Gall David Blavier http://www.one2team.com

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

script.aculo.us is an open-source JavaScript framework for visual effects and interface behaviours.
<br/><b>Source available from github</b>
The Git repository resides at:
<a href="http://github.com/madrobby/scriptaculous">http://github.com/madrobby/scriptaculous</a>
<br/>Check out the current development trunk with:
<code>git clone git://github.com/madrobby/scriptaculous.git</code>
<br/>As <b>script.aculo.us 1.xx is feature-frozen</b>, this development trunk is for <b>bugfixes only</b>.
<br/>New development should happen only for
<b>script.aculo.us 2</b>.
<br/><b>Creating a bug report</b>
When creating a bug report, be sure to include as much relevant information as possible. Post a an example that shows off the problem. Preferably, <b>alter the unit tests</b> and show through either changed or added tests how the expected behavior is not occuring.