In my app I have a main page with some panels (DIVs) filled with AJAX calls.
HTML
<html>
<head>
<title>jQuery test</title>
<script type="text/javascript" src="js/jquery-1.7.1.js"></script>
<script type="text/javascript" src="js/ago.js"></script>
</head>
<body>
<input type="button" value="Start 1" onclick="menuAnagReferenti()"/>
<div id="cmp-area">cmp-area</div>
</body>
</html>
ago.js
function menuAnagReferenti ()
{
$.ajax({
url: "./html/fromServer.html",
cache: false,
async: false,
dataType: "html",
success: function(data) {
$('#cmp-area').empty();
$('#cmp-area').append(data);
}//success
});
}//end
menuAnagReferenti() in this example is the function used to fill cmp-area panel with content get from server.
I noticed that every time I run this code (I use IE8 for the test), memory always grows. Working in this way for long time cause a performance deterioration of the whole application: after some time browser become unresponsive!
After several test, it seems that problem is in the content get from server.
This content is an HTML with some Javascript code inside most of the time.
If there is no javascript inside this HTML the memory growing does not happen!
In case HTML contains some javascript (even very short) the memory growing could still happen.
Could you help me to undestand where is the problem? Is there something wrong in my code that generate this problem?
Thanks for your helps!
Added Mar 2, 2012 --------
thanks Kevin: in my tests seems that ANY javascript generate the problem: more complex the javascript code and the memory grows more rapidly.
thanks Kory: I don't know how to use your suggestions in my case... I am using JQuery 1.7.1