apache / echarts

Apache ECharts is a powerful, interactive charting and data visualization library for browser
https://echarts.apache.org
Apache License 2.0
60.47k stars 19.62k forks source link

[Bug] echarts 使用百度地图组件更新option,total js heap size一直增长,造成内存泄漏 #18686

Open haolang opened 1 year ago

haolang commented 1 year ago

Version

5.4.2

Link to Minimal Reproduction

https://echarts.apache.org/examples/zh/editor.html?c=heatmap-bmap

Steps to Reproduce

https://echarts.apache.org/examples/zh/editor.html?c=heatmap-bmap 可在官方百度地图热力图示例中重现,不断开关主题设置按钮(深色模式)total js heap size 会一直增长,造成内存泄漏。

Current Behavior

更新 option会造成 total js heap size 一直增长

Expected Behavior

更新 option, total js heap size 保持相对稳定

Environment

- OS: windows
- Browser: chrom

Any additional comments?

No response

echarts-bot[bot] commented 1 year ago

@haolang 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] echarts uses the Baidu map component to update the option, and the total js heap size keeps growing, causing memory leaks **BODY** ### Version 5.4.2 ### Link to Minimal Reproduction https://echarts.apache.org/examples/zh/editor.html?c=heatmap-bmap ### Steps to Reproduce https://echarts.apache.org/examples/zh/editor.html?c=heatmap-bmap It can be reproduced in the official Baidu map heatmap example, constantly turning on and off the theme setting button (dark mode) Total JS Heap size will keep growing, causing memory leaks. ### Current Behavior Updating the option will cause the total js heap size to grow all the time ### Expected Behavior Update option, total js heap size remains relatively stable ### Environment ```markdown - OS: windows - Browser: chrom ``` ### Any additional comments? _No response_
helgasoft commented 1 year ago

Is this JS heap you are referring to, in Chrome? Yes, it's rising by toggling "Dark Mode". But if let alone it goes steadily back to single-digit KB size. So it seems the browser GC is doing its job and freeing up memory. There would be a problem if memory is NOT cleared, no?

image

haolang commented 1 year ago

Is this JS heap you are referring to, in Chrome? Yes, it's rising by toggling "Dark Mode". But if let alone it goes steadily back to single-digit KB size. So it seems the browser GC is doing its job and freeing up memory. There would be a problem if memory is NOT cleared, no?

image

However, even if I trigger college garbage manually, the memory footprint will not go down.

image

helgasoft commented 1 year ago

sorry, I'm a newbie in performance issues and should not comment these questions. Was looking at the red numbers (size trend) 😓