angular-charts
angular-charts copied to clipboard
Memory Leak?
I have a page which is long running and updates a line chart. When the page is running and I analyse it in chrome, I can see the memory profile increasing all the time:

However, when I run the page without the chart being rendered, it is pretty stable (the memory does go up but it goes back down again too based on the data being passed to the client):

The line chart has 3 series and 15 data points each as it only captures data for the past X amount of minutes:

The code I removed was this:
<div data-ac-chart="'line'"
data-ac-data="vm.searchTrayThroughputChart.data"
data-ac-config="vm.searchTrayThroughputChart.config"
class="chart"
id="chart">
</div>
version ?
Should be fixed with #86
0.2.4 . Is there anything else you would like me to post? I'm not too sure what else I could provide?
What is the update interval? I'm going to try to simulate it here to see if I can find the problem
Every 10 seconds
So you're updating the chart with new datas every 10 sec? Maybe that's the source of the problem? Does the data array get bigger?
No, the array stays the same length, 3 series each with 15 data points each
It just seems to be happening on line charts, I have pie charts on the page and that it is stable, but when I enable the line chart it gradually increases over time. I'm clearing the array and re-assigning it in my $interval:
vm.searchTrayThroughputChart.data = { series: [], data: [] };
vm.searchTrayThroughputChart.data.series = data.searchTrayThroughput.data.series; // Array of 3
vm.searchTrayThroughputChart.data.data = data.searchTrayThroughput.data.data; // Array of 15
I've created a sample repo which is showcasing the leak with line charts, as you'll be able to see, the node count, listeners is increasing gradually, even tho the data array is staying the same length (15).
https://github.com/CallumVass/AngularChartMemLeak
Here's what I got, seems normal.

There is one:

It's like elements are not destroyed when data array is deleted. I'm not familiar enough with D3.js to investigate :/
At any change of config or data the chart objects are re-created and the previous are not removed.
The same problem happens to me too.
div id="dataDomainStatus" ac-chart="typeDomainStatus" ac-data="data.DomainStatus" ac-config="configDomainStatus" style="width: 70%"></div
var dataStream = $websocket('ws://127.0.0.1:3129/stat');
dataStream.onMessage(function(msg) {
$scope.data = StatParser.parse(JSON.parse(msg.data));
});
Then, the memory grows slowly until it runs out. bower:
"dependencies": { "angular": "1.3.0", "angular-animate": "1.3.0", "angular-resource": "1.3.0", "angular-route": "1.3.0", "angular-ui-bootstrap": "0.11.2", "angular-i18n": "1.2.15", "angular-translate": "2.0.1", "angular-charts": "0.2.7", "jquery": "2.1.1", "font-awesome": "4.2.0", "bootstrap": "3.3.0", "angular-websocket": "1.0.8" },