What to do with jqPlot memory leak?
I have heard from too many people that JavaScript libruaries like jqPlot or Flot that are designed to draw g开发者_JS百科raphs have memory leaks if updated live for a long period of time. I know that most use the replot() function to update the graph in real time but that's where the problem seems to happen.
Has anybody figured out a work around this? Maybe refreshing the entire graph and the jquery code in a DIV?
you should use the “destroy” method (plot.destroy())
on your plot before you empty the container and draw the plot again.
It worked for me!
No, i tried it with emptying the div and redraw the complete diagram with jqPlot. That doesn't help either. I did it like this:
$('#diagramContainer').empty();
targetPlot = $.jqplot('#diagramContainer',
toDraw, diagramOptions);
Doing this lots of times with many data leads also to memory leaks.
精彩评论