1. #1
    Ext User
    Join Date
    Mar 2007
    Posts
    2
    Vote Rating
    0
    wanderingwalrus is on a distinguished road

      0  

    Default Memory Leak issue when using startAutoRefresh

    Memory Leak issue when using startAutoRefresh


    Guys & Gals,

    I'm trying to create a generic div that refreshes itself, and when you click a link from inside it, it submits to the div rather than reload the page. The div pretty much behaves like an iframe.

    The idea is to use the updateManager's on "load" event to attach onclick events to the links inside the loaded div.

    So far so good. With Jack's top notch doco, I'd managed to get stuff up and running. Everything seems to work. (see code at bottom)

    However, despite taking some advice from http://jibbering.com/faq/faq_notes/closures.html, the code below still leaks memory.

    The question is, has anyone tried anything similar? Any thoughts on what could be wrong? Is there any newbie thing I've completely missed out on?

    Does 'startAutoRefresh' have some sort of memory footprint?
    Does attaching events through addManagedListener cause memory to be leaked?
    Any hints on how I'd be able to debug what's in memory?


    FYI, by leaking I mean that the memory footprint just keeps on growing (~1.5GB overnight). In an hour, FireFox went from 45MB -> 170MB and IE went from 38MB -> 420MB in half an hour.

    Thanks,

    Mark C

    PS I'm using 0.33 RC3

    Code:
        <div id="latestChanges">
        </div>
        <script type="text/javascript">
            function initPortletlatestChanges()
            {
                var portlet = getEl('latestChanges');
                var updateManager = portlet.getUpdateManager();
                updateManager.showLoadIndicator = false;
                updateManager.on('update', rewriteFormAndLinks);
    
                portlet.load('/ajax/myChanges.action');
    
                updateManager.startAutoRefresh(10);
            }
    
            YAHOO.util.Event.onAvailable('latestChanges', initPortletlatestChanges);
        </script>
    and the 'rewriteFormAndLinks' looks a bit like:

    Code:
    function ajaxClickHandler(e, updateDivId)
    {
        e.preventDefault();
    
        var updater = getEl(updateDivId).getUpdateManager();
        var link = e.findTarget('internalLink', 'a');
    
        updater.update(link.href);
    }
    
    function rewriteFormAndLinks(el, oResponseObject)
    {
        var updater = el.getUpdateManager();
        var links = el.getChildrenByClassName('internalLink', 'a');
        for (var i = 0; i < links.length; i++)
        {
            links[i].addManagedListener('click', ajaxClickHandler, el.id);
        }
    }

  2. #2
    Sencha User
    Join Date
    Mar 2007
    Posts
    7,854
    Vote Rating
    2
    tryanDLS is on a distinguished road

      0  

    Default


    First, upgrade to the final .33 release - it's possible it's an old bug. Second do a search here for other threads on memory leaks - there was a discussion of this in the past, which may shed some light until somebody else suggests anything.

    Are you repeatedly adding listeners to the same link elements? Also, rather than adding listeners to each link, you could just add 1 listener to the containing div and then in the handler determine which link (if any) you're handling.

  3. #3
    Ext User
    Join Date
    Mar 2007
    Posts
    2
    Vote Rating
    0
    wanderingwalrus is on a distinguished road

      0  

    Default


    Quote Originally Posted by tryanDLS
    Second do a search here for other threads on memory leaks
    I had a read of this this, but I think the problem here is a little different? That post was more about leaks between page refreshes, whereas mine seems to be an issue of memory use with reloading elements of the page. I don't know if there's an "unload" hook for elements within a window?

    Thanks for your suggestions, I'll try and update the libs to the latest version and then try the onclick on the DIV to see if that helps at all.

Similar Threads

  1. iframe cause memery leak in IE6?
    By jasspier in forum Ext 1.x: Bugs
    Replies: 5
    Last Post: 26 Sep 2007, 4:39 AM
  2. problem with memory leak
    By kuzynpiy in forum Ext 1.x: Help & Discussion
    Replies: 31
    Last Post: 28 Jun 2007, 2:31 AM
  3. [SOLVED] Memory Leak in Paging Grid Example?
    By cobnet in forum Ext 2.x: Help & Discussion
    Replies: 7
    Last Post: 3 May 2007, 8:24 PM
  4. Grid DataModel keeps data in memory
    By tane in forum Ext 1.x: Help & Discussion
    Replies: 2
    Last Post: 24 Feb 2007, 12:38 PM
  5. [OPEN] UpdateManager.startAutoRefresh behavior
    By tryanDLS in forum Ext 1.x: Bugs
    Replies: 2
    Last Post: 28 Sep 2006, 12:21 PM

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar