[jQuery] ajax and memory growth IE and FF
Hi,
I was testing the ajax component (latest build) and found that IE and
FF would show a growth in memory (task manager). I made a test (see
below) with "normal" XMLHTTP request as a reference which showed no
growth at all. (after refresh memory is freed again)
The file I loaded was a plain HTML table (no events thus no memory
leak; checked with sIEve. Before I go into jquery core to figure out
where it stores data: was this already adressed and I missed the
thread when searching this group?
here the test code:
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-
latest.js"></script>
</head>
<body>
<input type='button' onclick='load()' value='load' />
<input type='button' onclick='load2()' value='load2' />
<div id='output'></div>
<script>
var sFile = "table.html";//&nRand=" + Math.random();
load = function(){
$('#output').empty();
$.ajax({
type: "GET",
url: sFile,
success: function( html ){
$('#output').html( html );
}
});
}
load2 = function(){
if(navigator.appName == "Microsoft Internet Explorer") {
http = new ActiveXObject("Microsoft.XMLHTTP");
} else {
http = new XMLHttpRequest();
}
http.open("GET", sFile, true);
http.onreadystatechange = function() {
if(http.readyState == 4) {
document.getElementById( 'output' ).innerHTML = http.responseText;
}
}
http.send(null);
}
onload = function(){
//setInterval(function(){load();}, 250); <-- memory grows
setInterval(function(){load2();}, 250); // <-- no memory growth
}
</script>
</body>
</html>