Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Ext JS Premium Member
    Join Date
    Apr 2010
    Location
    Midwest, USA
    Posts
    96
    Vote Rating
    2
    Reimius is on a distinguished road

      0  

    Default Memory Leak when Using Ext4 Sandbox and IFrame

    Memory Leak when Using Ext4 Sandbox and IFrame


    I posted this in the general forums, but haven't gotten a response. Hopefully I'll get some more help here

    Hi Everyone,

    We have a dashboard system for stats at my work and each dashboard is in an iframe (due to legacy support). So each time a person using our system wants to look at their stats, the iframe is refreshed and it loads up many Ext.grids and Flash charts all arranged in many patterns. We wanted to slowly cut over our charting system to Ext4, with the older grids still remaining on Ext3 for a time. Right after the initial release of including the Ext4 sandbox library in our dashboard system, we started getting many out of memory errors. After some time tracking down the source we created a simple scenario which can consistently cause a large memory leak.

    outer.html - this contains the iframe which loads the other page
    Code:
    <!doctype html>
    <html>    
    <head>    
    <script type="text/javascript">        
    var run = false;        
    function reloadIframe() {
        document.getElementById("myiframe").src = "inner.html";
        if(run) {
            window.setTimeout("reloadIframe();", 1000);
        }
    }
    </script>
    
    </head>
    <body>
    
    <iframe id="myiframe" width="640" height="480"></iframe><br/>
    <input type="button" value="Start" onclick="run = true; reloadIframe();"/>
    <input type="button" value="Stop" onclick="run = false;"/>
    </body>
    </html>
    inner.html
    Code:
    <!doctype html><html>    <head>
    <script type="text/javascript" src="ext-base-debug-3.2.1.js"></script>
    <script type="text/javascript" src="ext-all-debug-3.2.1.js"></script>
    <script type="text/javascript" src="ext-all-sandbox-debug-4.0.7.js"></script>
    </head>
        <body><h1>Inner Frame</h1></body>
    </html>
    We can't figure out why this is causing a memory leak, we have tried many methods of destroying the iframe and the objects within. I'm wondering if anyone else can provide insight into this memory leak.

    Our environment includes:
    Client + Server (doesn't leak if done locally)
    Tested IE9 and Firefox current (does not leak in chrome)

    And the memory leak doesn't cause an out of memory right away. Having task manager open in windows you can see the memory consumption go up by like 20mb with each refresh of the inner iframe.
    Last edited by arthurakay; 15 Mar 2012 at 8:14 AM. Reason: code formatting

  2. #2
    Sencha - Services Team arthurakay's Avatar
    Join Date
    Sep 2008
    Location
    Antioch, IL
    Posts
    1,352
    Vote Rating
    32
    arthurakay is a jewel in the rough arthurakay is a jewel in the rough arthurakay is a jewel in the rough

      0  

    Default


    Googling for "settimeout memory leak" i see a bunch of possibilities.

    One being this:
    - http://pavel.kuzub.com/settimeout-memory-leak

    Try not passing a string to setTimeout()... does that help?
    Arthur Kay
    Developer Relations Manager, Sencha Inc.

    Twitter | Sencha Chicago User Group

  3. #3
    Ext JS Premium Member
    Join Date
    Apr 2010
    Location
    Midwest, USA
    Posts
    96
    Vote Rating
    2
    Reimius is on a distinguished road

      0  

    Default


    The setTimeout is only there to run a continuous loop so you don't have to click the button over and over to see results. Our real application example does not even use that function.

  4. #4
    Ext JS Premium Member
    Join Date
    Apr 2010
    Location
    Midwest, USA
    Posts
    96
    Vote Rating
    2
    Reimius is on a distinguished road

      0  

    Default


    Our best guess is that somehow the Ext4 sandbox library is creating objects on the parent frame (instead of its own window scope) due to a coding mistake which would only show up in a situation like this.

  5. #5
    Ext JS Premium Member
    Join Date
    Apr 2010
    Location
    Midwest, USA
    Posts
    96
    Vote Rating
    2
    Reimius is on a distinguished road

      0  

    Default


    Any help on this?

  6. #6
    Ext JS Premium Member
    Join Date
    Apr 2010
    Location
    Midwest, USA
    Posts
    96
    Vote Rating
    2
    Reimius is on a distinguished road

      0  

    Default


    Can I have a moderator move this to bugs? Thanks,


    REQUIRED INFORMATIONExt version tested:
    • Ext 4.0.7 (Sandbox)
    • Ext 3.2.1
    Browser versions tested against:
    • IE9
    • IE8
    • FF3
    • Google Chrome (does not happen in this browser)
    DOCTYPE tested against:
    • IE9 Standards Mode
    Description:
    • We have a dashboard system for stats at my work and each dashboard is in an iframe (due to legacy support). So each time a person using our system wants to look at their stats, the iframe is refreshed and it loads up many Ext.grids and Flash charts all arranged in many patterns. We wanted to slowly cut over our charting system to Ext4, with the older grids still remaining on Ext3 for a time. Right after the initial release of including the Ext4 sandbox library in our dashboard system, we started getting many out of memory errors. After some time tracking down the source we created a simple scenario which can consistently cause a large memory leak.
    Steps to reproduce the problem:
    • Load the example
    The result that was expected:
    • No memory leak
    The result that occurs instead:
    • ~20mb memory leak on each refresh of the inner iframe
    Test Case:see code in first postHELPFUL INFORMATIONDebugging already done:
    • Remove the 4.0 sandbox and everything is fine

  7. #7
    Sencha User
    Join Date
    May 2013
    Posts
    8
    Vote Rating
    1
    m0r14rty is on a distinguished road

      0  

    Default Why hasn't this been looked at?

    Why hasn't this been looked at?


    This is a crippling issue for us as well, I'm really astonished such a roadblock has gone unfixed for over a year now. The issue still stands with even the 4.2.1.744 beta. Any iframes created never release their memory back. Open a few extra tabs with an iframe in them and you'll see increments of 20-100MB each time, staying there until IE8 is closed.

    Same problem also seen in an older issue as well: http://www.sencha.com/forum/showthread.php?143545

    I didn't know whether to start a new thread or to bring back the old one, but this saved me from creating an identical example. In our case, simply loading an iframe with a viewPanel, then closing the parent window causes the same issue.
    Last edited by m0r14rty; 9 May 2013 at 2:00 PM. Reason: added another link to same issue

  8. #8
    Sencha Premium Member
    Join Date
    Mar 2012
    Posts
    46
    Vote Rating
    4
    andrewx is on a distinguished road

      0  

  9. #9
    Sencha User
    Join Date
    May 2013
    Posts
    8
    Vote Rating
    1
    m0r14rty is on a distinguished road

      0  

    Default


    We've gone as far as removing event handlers and then setting the iframe to
    Code:
    <div></div>
    before destroying, and still see a 20MB+ leak every time. The issue isn't seen in Chrome (the memory clears out after a slight delay), and I'm unable to test within IE9 or IE10.