#149 ✓ resolved
Vitaliy

IE Leak: dom:loaded event leaks when using frames

Reported by Vitaliy | June 6th, 2008 @ 12:21 PM

This code will leak in Internet Explorer when used in frames.

If we write the same javascript code in index1 & index2 then Internet Eplorer will leak about 1Mb on every reload.

frameset.html

<html>
	<head></head>
	<frameset cols="50%,*">
		<frame src="index1.htm" />
		<frame src="index2.htm" />
	</frameset>
</html>

index1.html & index2.html

<html>
	<head>
		<script type="text/javascript" src="prototype.js"></script>
		<script type="text/javascript" src="script-prototype.js"></script>
	</head>
	<body>
	</body>
</html>

Javascript code, which causes leak:

$(document).observe('dom:loaded', function() { });

Comments and changes to this ticket

  • John-David Dalton

    John-David Dalton June 6th, 2008 @ 02:32 PM

    We have fixed the memoryleak issue for the next 1.6.0.3 release.

    I have tested it with frames, but I will test it again using your example to confirm.

    • JDD
  • John-David Dalton

    John-David Dalton June 6th, 2008 @ 11:08 PM

    • State changed from “new” to “resolved”

    From my tests I have the index1 and index 2 look like (using the latest git core version)

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
        <title>LeakTest</title>
        <meta http-equiv="refresh" content="1;url="/> 
        <script type="text/javascript" src="prototype.js"></script>
      </head>
      <body>
        <form>
          <div id="divId" style="width:10em">Test</div>
          <input name="test" value="1"/><input name="test" value="1"/><input name="test" value="1"/><br/>
          <input name="test" value="1"/><input name="test" value="1"/><input name="test" value="1"/><br/>
          <input name="test" value="1"/><input name="test" value="1"/><input name="test" value="1"/><br/>
          <input name="test" value="1"/><input name="test" value="1"/><input name="test" value="1"/><br/>
          <input name="test" value="1"/><input name="test" value="1"/><input name="test" value="1"/><br/>
          <input name="test" value="1"/><input name="test" value="1"/><input name="test" value="1"/><br/>
          <input name="test" value="1"/><input name="test" value="1"/><input name="test" value="1"/><br/>
          <input name="test" value="1"/><input name="test" value="1"/><input name="test" value="1"/><br/>
          <input name="test" value="1"/><input name="test" value="1"/><input name="test" value="1"/><br/>
          <input name="test" value="1"/><input name="test" value="1"/><input name="test" value="1"/><br/>
          <input id="time" value="" style="border: 1px solid"/>
        </form>
        
        <script type="text/javascript">
        
          function c(event) {
            alert(this.tagName);
          }
          
          $('divId').observe('click', c);
          var t = new Date().getTime();
          $$('input').invoke('disable');
          t = new Date().getTime() - t;
          $('time').value = t;
          
        </script>
      </body>
    </html>
    

    with no leak, or just a very very slow leak. (this means it should be fixed in the next release 1.6.0.3)

  • Vitaliy

    Vitaliy June 16th, 2008 @ 04:20 PM

    Yeah, I can see, that withe version from git no leak occurs, thanks!

  • Vitaliy

    Vitaliy December 3rd, 2008 @ 11:36 AM

    • Tag set to ie, leak

    Strange, but I can reproduce this bug with 1.6.0.3

    IE6 version: 6.0.2900.2180.xpsp_sp2_rtm.040803-2158

    test case attached

    P.S. I've also noticed, that jQuery has the same leak

  • Diego Perini

    Diego Perini December 3rd, 2008 @ 02:25 PM

    Vitaliy, sems to me you just forgot to cleanup the handler you registered.

    Use this in your script and the leak is gone.

    function fn(){

    $(document).stopObserving('dom:loaded', fn);
    
    

    }; $(document).observe('dom:loaded', fn);

    I don't think the framework should do this for you.

    -- Diego

  • Vitaliy

    Vitaliy December 3rd, 2008 @ 04:17 PM

    Hmm, I've found bug #425 it fixes leak

  • Tobie Langel

    Tobie Langel July 24th, 2009 @ 04:05 AM

    • Tag cleared.

    [not-tagged:"ie" not-tagged:"ie6" not-tagged:"ie7" not-tagged:"ie8" bulk edit command]

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 »

The Prototype JavaScript library.

Shared Ticket Bins

People watching this ticket

Attachments

Pages