I\'m redrawing the chart based on new data each second, and it works and looks great, but I notice it increase memory like 1 MB usage each second. Any way to fix this? I notice
Had same issue, was able to fix it by adding a few lines to Google's clearChart() function.
W.clearChart = function() {
//this fixes the leak
hv = {};
iv = {};
jv = {};
...
};
More Details:
https://www.google.com/uds/api/visualization/1.0/4086f2e8fc632adc52e6d6795a5637a4/format+en,default,corechart.I.js
Download this file, make the change mentioned above. In your code, add a script tag to load above file from your webserver and comment out the following line:
// google.load('visualization', '1', { packages: ['corechart'] });
The memory will go up but will come back down on it's own after a few minutes.
I'm using clearChart() but if you don't want to clear the chart, then create your own function (e.g. memoryLeakFix()) and call it periodically.
Here's a test page (the 1.js is the modified file from step 1). It basically creates new chart and redraws every 100ms. You will see memory go up but hit "Stop" link to stop the redrawing and wait a few minutes and memory will come down.
Stop