c3js / c3

:bar_chart: A D3-based reusable chart library
http://c3js.org
MIT License
9.33k stars 1.39k forks source link

Memory Leak when load() API is called even with option "unload: true" #2825

Open monexiao opened 3 years ago

monexiao commented 3 years ago

Same issue as #1961, I create 7 line-charts with timeseries x-axis, and each chart has 240 data points. Only on page load, it uses c3.generate() to create charts, and then each chart uses c3.load() with unload option set as “true” (means unload all data mentioned in the c3 reference document) to update its 240 data points per 5 minutes. I can observe the memory usage will increase 30MB~100MB per update in whole page by checking chrome task monitor. It is easy to reproduce by using setTimeout() function or create a button to manually trigger.

By the way, the other case I found if the c3.chart is rendered complete, when blur the page to other window or app to do something about several minutes, and then back to the page with the c3.chart, the page will freeze a period of time. The cpu/memory usage grow up very fast until the the page recoveries.

PS. The page is the visible tab.

Is there any idea for this issue ?

monexiao commented 3 years ago

Sorry about the wrong report. I found the my code flow is wrong, the c3.load() with option “unload” as “true” is worked, the memory will be released in the few time.

But the case of freezing a period of time can be seem.