DaveC426913
Programmer
This is a real showtopper.
My application needs to run for hours at a time without resetting, using limited processing cycles and limited memory. It uses Ajax to poll the server every few seconds.
Unfortunately, the setInterval to used to make the poll tick over is leaking.
I'm running a barebones test to see how bad it is.
var x;
function startme(){
x = setInterval("loop()",100);
}
function stopme(){
clearInterval(x);
}
var imAlive = 0;
function loop(){
document.getElementById('target').innerHTML = imAlive;
imAlive++;
}
This ran OK overnight. 200,000 ticks and still going.
But anything more complex and the setIntervals can start overlapping. Then the memory slowly starts creeping up. With a very simple interface, the poller ran for less than an hour before burning through all the memory.
Even stopping the setInterval to let it catch up doesn't work. If I watch the system resources they're always a many k higher each time.
I need to figure out a way of ensuring it doesn't eat up all the memory - or we're dead in the water!
My application needs to run for hours at a time without resetting, using limited processing cycles and limited memory. It uses Ajax to poll the server every few seconds.
Unfortunately, the setInterval to used to make the poll tick over is leaking.
I'm running a barebones test to see how bad it is.
var x;
function startme(){
x = setInterval("loop()",100);
}
function stopme(){
clearInterval(x);
}
var imAlive = 0;
function loop(){
document.getElementById('target').innerHTML = imAlive;
imAlive++;
}
This ran OK overnight. 200,000 ticks and still going.
But anything more complex and the setIntervals can start overlapping. Then the memory slowly starts creeping up. With a very simple interface, the poller ran for less than an hour before burning through all the memory.
Even stopping the setInterval to let it catch up doesn't work. If I watch the system resources they're always a many k higher each time.
I need to figure out a way of ensuring it doesn't eat up all the memory - or we're dead in the water!