RGraph.AJAX.getCSV('/getdata.html', myAJAXCallback); using memory - memory leak?


« Back to message list

Enter your email address to get email updates on this topic. You can stop receiving updates by clicking the link in the update email messages.

Posted by Dennis on 15th April 2014
Dear Everyone,

I'm using gauge-ajax.html as a base for my web page. I draw 4 gauges and notice browser
increasingly using memory when it calls RGraph.AJAX.getCSV('/getdata.html', myAJAXCallback) function.

var delay = 500;
function myAJAXCallback(num){
rpm.value = num[0];
rpm.grow({frames: 25})

map.value = num[1];
map.grow({frames: 25})

vss.value = num[3];
vss.grow({frames: 25})

coolant.value = num[4];
coolant.grow({frames: 25})

/* Make another AJAX call after the delay (which is in milliseconds)*/
/*setTimeout(function (){RGraph.AJAX.getCSV('/getdata.html', myAJAXCallback);}, delay); */
setTimeout(function (){
            RGraph.AJAX.getCSV('/getdata.html', myAJAXCallback);
           }, delay);
}

After few few hours of testing, web browser refresh slowly and finally it quit refreshing.

I'm using windows 7, Opera and Google Chrome web browsers.
I use window Task manager to monitor memory and seeing the using of memory growing.

Does anyone see the issue and know how to fix it?
Thanks in advance,
Dennis
Posted by Richard on 15th April 2014
Hi there,

Try this page in a browser other than Chrome:

www.rgraph.net/demos/gauge-ajax.html

Chrome messes with timers when tabs are in the background so try Internet Explorer or Firefox.




Richard
www.rgraph.net
If RGraph has helped you - please share the website - thanks!

RGraph Priority Support: www.rgraph.net/support#priority-support
Posted by Dennis on 15th April 2014
Hi Richard,

I tried both IE and Firefox, their using of memory still increase.
I replaced grow function with RGraph.RedrawCanvas(rpm.canvas);
It improved but the memory still growing.

Thanks,
Denis
Posted by Richard on 16th April 2014
Hi there,

Are you creating a new object every time? Try changing the .grow() call to a .draw() call (and don't forget to clear the canvas each time:

RGraph.clear(gauge.canvas);
gauge.value = num;
gauge.draw();
//gauge.grow();

Memory usage appears to be holding steady for me.


Richard
www.rgraph.net
If RGraph has helped you - please share the website - thanks!

Add a reply

 




« Back to message list
RGraph on social media