angular-charts icon indicating copy to clipboard operation
angular-charts copied to clipboard

Memory Leak?

Open CallumVass opened this issue 11 years ago • 12 comments

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:

image

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):

image

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

image

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>

CallumVass avatar Jul 07 '14 12:07 CallumVass

version ?

Should be fixed with #86

soyuka avatar Jul 07 '14 14:07 soyuka

0.2.4 . Is there anything else you would like me to post? I'm not too sure what else I could provide?

CallumVass avatar Jul 07 '14 14:07 CallumVass

What is the update interval? I'm going to try to simulate it here to see if I can find the problem

felipeleusin avatar Jul 07 '14 18:07 felipeleusin

Every 10 seconds

CallumVass avatar Jul 07 '14 18:07 CallumVass

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?

soyuka avatar Jul 07 '14 18:07 soyuka

No, the array stays the same length, 3 series each with 15 data points each

CallumVass avatar Jul 07 '14 18:07 CallumVass

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

CallumVass avatar Jul 08 '14 08:07 CallumVass

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

CallumVass avatar Jul 08 '14 09:07 CallumVass

Here's what I got, seems normal. screen shot 2014-08-12 at 3 21 57 pm

chinmaymk avatar Aug 12 '14 22:08 chinmaymk

There is one: screen shot 2014-08-13 at 08 17 01

It's like elements are not destroyed when data array is deleted. I'm not familiar enough with D3.js to investigate :/

soyuka avatar Aug 13 '14 06:08 soyuka

At any change of config or data the chart objects are re-created and the previous are not removed.

Oleg-Imanilov avatar Sep 06 '14 21:09 Oleg-Imanilov

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" },

empirefox avatar Feb 04 '15 12:02 empirefox