{"action":"created","issue":{"url":"https://api.github.com/repos/google/google-visualization-issues/issues/1996","labels_url":"https://api.github.com/repos/google/google-visualization-issues/issues/1996/labels{/name}","comments_url":"https://api.github.com/repos/google/google-visualization-issues/issues/1996/comments","events_url":"https://api.github.com/repos/google/google-visualization-issues/issues/1996/events","html_url":"https://github.com/google/google-visualization-issues/issues/1996","id":87131913,"number":1996,"title":"Memory leak in all most chart types","user":{"login":"ekhaidarov","id":5084656,"avatar_url":"https://avatars.githubusercontent.com/u/5084656?v=3","gravatar_id":"","url":"https://api.github.com/users/ekhaidarov","html_url":"https://github.com/ekhaidarov","followers_url":"https://api.github.com/users/ekhaidarov/followers","following_url":"https://api.github.com/users/ekhaidarov/following{/other_user}","gists_url":"https://api.github.com/users/ekhaidarov/gists{/gist_id}","starred_url":"https://api.github.com/users/ekhaidarov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ekhaidarov/subscriptions","organizations_url":"https://api.github.com/users/ekhaidarov/orgs","repos_url":"https://api.github.com/users/ekhaidarov/repos","events_url":"https://api.github.com/users/ekhaidarov/events{/privacy}","received_events_url":"https://api.github.com/users/ekhaidarov/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"dlaliberte","id":570125,"avatar_url":"https://avatars.githubusercontent.com/u/570125?v=3","gravatar_id":"","url":"https://api.github.com/users/dlaliberte","html_url":"https://github.com/dlaliberte","followers_url":"https://api.github.com/users/dlaliberte/followers","following_url":"https://api.github.com/users/dlaliberte/following{/other_user}","gists_url":"https://api.github.com/users/dlaliberte/gists{/gist_id}","starred_url":"https://api.github.com/users/dlaliberte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dlaliberte/subscriptions","organizations_url":"https://api.github.com/users/dlaliberte/orgs","repos_url":"https://api.github.com/users/dlaliberte/repos","events_url":"https://api.github.com/users/dlaliberte/events{/privacy}","received_events_url":"https://api.github.com/users/dlaliberte/received_events","type":"User","site_admin":false},"milestone":null,"comments":20,"created_at":"2015-06-10T22:40:36Z","updated_at":"2015-09-01T14:34:00Z","closed_at":null,"body":"There is still a memory leak across various chart types : gauge, ComboChart, LineChart. \r\n\r\nI am including sample js/html that will populate gauge on 1 second interval. You will notice that Chrome memory set keeps jumping with every iteration.  General draw function is being used that calls clearChart() before every draw operation. Please advise if it can be fixed or how to work around it. Thanks.\r\n\r\n<pre>\r\ngoogle.load(\"visualization\", \"1\", { packages: [\"gauge\", \"corechart\", 'line'] });\r\n        google.setOnLoadCallback(test);\r\n\r\nfunction test()\r\n        {    \r\n            setInterval(function () { onCPU(Math.floor((Math.random() * 100) + 1)); }, 1000);\r\n        }\r\n\r\nvar gCharts = [];\r\nfunction drawChart(data, options, divId, fchartType)\r\n        {\r\n            if(gCharts[divId] != null && gCharts[divId] != undefined)\r\n            {\r\n                gCharts[divId].clearChart();\r\n                gCharts[divId] = null;                \r\n            }\r\n            gCharts[divId] = new fchartType(document.getElementById(divId));\r\n            gCharts[divId].draw(data, options);\r\n            data = null;\r\n            options = null;\r\n        }\r\n\r\n        // historical data over cpu and bandwidth\r\n        var MAX_HISTORY = 120;\r\n        var cpuHistory = [];\r\n        var tsStartTime = new Date().getTime();\r\n\r\n        \r\n        function onCPU(cpuLoad)\r\n        {\r\n            var data = google.visualization.arrayToDataTable([\r\n              ['Label', 'Value'],\r\n              ['CPU', cpuLoad]]);\r\n\r\n            var options = {\r\n                width: 400, height: 120,\r\n                redFrom: 90, redTo: 100,\r\n                yellowFrom: 75, yellowTo: 90,\r\n                minorTicks: 5\r\n            };\r\n\r\n            drawChart(data, options, \"cpu_div\", google.visualization.Gauge);\r\n            data.removeRows(0, data.getNumberOfRows());\r\n            data.removeColumns(0, data.getNumberOfColumns());\r\n            data = null;\r\n            options = null;\r\n\r\n            \r\n            if(cpuHistory.length > MAX_HISTORY)\r\n            {\r\n               cpuHistory.shift(); \r\n            }   \r\n            \r\n            cpuHistory[cpuHistory.length] = [\r\n            Math.abs(Math.floor((new Date().getTime() - tsStartTime)/1000)),\r\n            cpuLoad];\r\n\r\n            \r\n            var CPUHistoryData = new google.visualization.DataTable();\r\n            CPUHistoryData.addColumn('number', 'Time');\r\n            CPUHistoryData.addColumn('number', 'CPU');\r\n            CPUHistoryData.addRows(cpuHistory);\r\n\r\n            var CPUHistoryOptions = {\r\n              title: 'CPU Load',\r\n              legend: { position: 'none' }\r\n            };\r\n\r\n          drawChart(CPUHistoryData, CPUHistoryOptions, 'cpu_history', google.visualization.LineChart);\r\n          CPUHistoryData = null;\r\n          CPUHistoryOptions = null;\r\n        }\r\n\r\n</pre>\r\n<pre><code> \r\n &lt;body&gt;\r\n    &lt;div id=\"cpu_div\" style=\"width: 100px; height: 120px; position: absolute; left: 10px; top: 10px\" /&gt; \r\n    &lt;div id=\"cpu_history\" style=\"width: 600px; height: 300px; position: absolute; left: 10px; top: 130px;\"/&gt;\r\n&lt;/body&gt;\r\n</code></pre>"},"comment":{"url":"https://api.github.com/repos/google/google-visualization-issues/issues/comments/136742199","html_url":"https://github.com/google/google-visualization-issues/issues/1996#issuecomment-136742199","issue_url":"https://api.github.com/repos/google/google-visualization-issues/issues/1996","id":136742199,"user":{"login":"ekhaidarov","id":5084656,"avatar_url":"https://avatars.githubusercontent.com/u/5084656?v=3","gravatar_id":"","url":"https://api.github.com/users/ekhaidarov","html_url":"https://github.com/ekhaidarov","followers_url":"https://api.github.com/users/ekhaidarov/followers","following_url":"https://api.github.com/users/ekhaidarov/following{/other_user}","gists_url":"https://api.github.com/users/ekhaidarov/gists{/gist_id}","starred_url":"https://api.github.com/users/ekhaidarov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ekhaidarov/subscriptions","organizations_url":"https://api.github.com/users/ekhaidarov/orgs","repos_url":"https://api.github.com/users/ekhaidarov/repos","events_url":"https://api.github.com/users/ekhaidarov/events{/privacy}","received_events_url":"https://api.github.com/users/ekhaidarov/received_events","type":"User","site_admin":false},"created_at":"2015-09-01T14:34:00Z","updated_at":"2015-09-01T14:34:00Z","body":"That's great news! Thank you. We are shipping a release ourselves in couple of weeks, I am curious if by chance I could get an early copy when you feel it is more less stable?"}}