I'm running this script in Google Chrome while using the Chrome Task Manager to monitor memory usage:
<html>
<head>
<title>Test Page</title>
<script type="text/javascript" src="jquery-1.3.2.js"></script>
<script type="text/javascript">
var count = 0;
function incrementContent() {
$("#content").text(count);
count++;
setTimeout(incrementContent, 5);
}
</script>
</head>
<body onload="incrementContent()">
<div id="content">
</div>
</body>
</html>
Memory usage will steadily increase to a maximum of ~31,000K, it then stays at this level.
As far as I can see the loop should simply overwrite the same element in the document.
What is causing the large amount of memory to be allocated?
Using IE 8 I can see no no discernible increase in memory usage while running the script.
With Firefox 3.5.3 memory usage goes through a cycle of increasing by a few megabytes over a minute or so and then falling back its baseline level.