最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - What to do with jqPlot memory leak? - Stack Overflow

programmeradmin1浏览0评论

I have heard from too many people that JavaScript libruaries like jqPlot or Flot that are designed to draw graphs 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?

I have heard from too many people that JavaScript libruaries like jqPlot or Flot that are designed to draw graphs 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?

Share Improve this question asked Jun 17, 2011 at 0:05 kidalexkidalex 1,5272 gold badges12 silver badges14 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 6

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 plete 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.

发布评论

评论列表(0)

  1. 暂无评论