[Bug] Echart setOption长时间更新数据导致内存泄漏
Version
5.6.0
Link to Minimal Reproduction
https://jsfiddle.net/wangfengCode/fm6ucqxp/
Steps to Reproduce
1、打开网址下载到本地并在浏览器运行chrome、edge均可
2、打开控制台切换至内存tab标签
3、每隔几分钟点击录制按钮,查看快照内存大小(可以穿插点击垃圾回收按钮)
内存在一直增大
隐私模式下,共计运行约5分钟
常规模式下,共计运行约5分钟
Current Behavior
在仅绘制一个图表且使用原生JS无响应式包装的前提下,隐私模式下内存五分钟上涨了接近5M,中间点击过几次垃圾回收按钮,而真实项目需求为多个图表,推送数据更多更频繁,线上环境出现过内存溢出最后崩溃的问题。
Expected Behavior
当前怀疑是setOptions可能存在潜在的内存泄露,希望官方人员进行排查并进行问题修复。
Environment
- OS:Windows 11
- Browser:Chrome 142.0.7444.176 Edge142.0.3595.80
- Framework:Vue@3
Any additional comments?
#20151 曾提及过此类问题且已经进行了修改,但后续仍有人提及setOption可能存在内存泄漏
@SmartBigFeng It seems you are not using English, I've helped translate the content automatically. To make your issue understood by more people and get helped, we'd like to suggest using English next time. 🤗
TRANSLATED
TITLE
[Bug] Echart setOption updating data for a long time causes memory leaks
BODY
Version
5.6.0
Link to Minimal Reproduction
https://jsfiddle.net/wangfengCode/fm6ucqxp/
Steps to Reproduce
- Open the URL and download it locally and run chrome and edge in the browser
- Open the console and switch to the memory tab
- Click the record button every few minutes to check the snapshot memory size (you can click the garbage collection button interspersed)
The memory has been growing
In privacy mode, it runs for about 5 minutes
In normal mode, it runs for about 5 minutes in total
Current Behavior
Under the premise of drawing only one chart and using native JS unresponsive packaging, the memory in privacy mode increased by nearly 5M in five minutes, and the garbage collection button was clicked several times in the middle, while the real project required multiple charts, pushing data more and more frequently, and the online environment had the problem of memory overflow and finally crashing.
Expected Behavior
The current suspicion is that setOptions may have a potential memory leak, and I hope that officials will troubleshoot and fix the problem.
Environment
- OS:Windows 11
- Browser:Chrome 142.0.7444.176 Edge142.0.3595.80
- Framework:Vue@3
Any additional comments?
#20151 has mentioned such issues and has been fixed, but there have been subsequent mentions that setOption may have a memory leak
我没有具体测试,只是看了下代码,在定时更新的那块代码,我只看到一直往 series data push 数据,却没有移除的逻辑,这样数组越来越大,也是导致内存上涨的原因吧?