Suspect memory leak when update frequently in realtime
dragonsoft-cara opened this issue · comments
Cara commented
Hi there,
I found memory leak when using exist().remove() and append() to dynamically update digram.
Could any one help to see if there's any wrong in my code or is this an issue with d3, I'm using version 3.x.
Here's the demo:
JSBin
Devtool friendly
The main code to update diagram:
var letters = d3.select('svg').selectAll('text').data(vowelsAndNums, function(d) {
return d;
});
letters.exit().remove();
letters.attr('x', function(d,i) { return i*15; });
letters.enter().append('text')
.text(function(d) { return d; })
.attr('x', function(d,i) { return i*15; })
.attr('y', 15);
Mike Bostock commented
I don’t support D3 3.x anymore, sorry. I’m aware of a memory leak with event listeners #189 (#186 (comment)), but that shouldn’t apply in this example since you’re not using selection.on.