empty() and memory leak

empty() and memory leak

Hello,

I am having a big problem with memory consumption with a jQuery script.
What I am trying to do is reload a DIV tag at certain intervals with some elements generated by a ASP.NET MVC application.
The DIV AppointmentsList contains the elements I am loading. It is pretty simple.
After one day of refreshing the broswer IE8 (but I've tried with other browsers and the problem is still there) loads more than 800Mb of memory.
It seems that the empty() function "

$("#AppointmentsList").empty();" cannot release the DOM elements.
Is there anyone else faced the same problems?

Regards

Alberto





  1. $(document).ready(function() {
        $
    ('#loading').html("<img src='Images/bigloader.gif' />").hide();
       
    ScheduledAction(LoadAppointments, -1, 1000);
    });


    function ScheduledAction(func, times, interval) {
       
    var ID = window.setInterval(function() {
           
    if (times > -1) {
               
    if (--times <= 0)
                    window
    .clearInterval(ID);
           
    }
            func
    ();
       
    }, interval);
    }


    function LoadAppointments() {

        $

    ("#AppointmentsList").empty();
        $
    ('#loading').show();
        $
    .get(UrlAction,
               
    function(data) {
                   
    if (data != '') {
                        $
    ('#AppointmentsList').append(data);
                        $
    ('#loading').hide();
                   
    }
                   
    else {
                        $
    ('#loading').fadeOut(3000);
                   
    }
               
    });
    }