Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI 内存溢出 #4504

Closed
pearmini opened this issue Dec 21, 2022 · 1 comment
Closed

CI 内存溢出 #4504

pearmini opened this issue Dec 21, 2022 · 1 comment
Assignees
Labels

Comments

@pearmini
Copy link
Member

pearmini commented Dec 21, 2022

CI 内存溢出

目前 G2 的远程 CI 会出现内存溢出的问题,导致 __tests__/integration/snapshot.spec.ts 不能正常运行测试。

image

问题

问题应该是在在切换不同测试图表的时候,canvas.destroy() 并没有销毁上一个图表的图形元素,导致内存一直在增加。定位到问题应该是 G 依赖 antv/util 里面的 memoize,而这个函数用的 Map 去缓存结果,导致这个 Map 一直保存着图形元素的强引用,从而它们不会被垃圾回收。

解决办法

antv/util 里面的 memoize 使用 WeakMap

临时方案

每个人提交的 PR 一定要在本地运行 npm run ci 保证本地没有问题,然后再合并到 v5 分支。

@pearmini pearmini added the V5 label Dec 21, 2022
@pearmini pearmini added this to the 5.0.0-beta.6 milestone Dec 21, 2022
@pearmini pearmini removed this from the 5.0.0-beta.6 milestone Jan 9, 2023
@pearmini
Copy link
Member Author

fix: #4677

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Done
Development

No branches or pull requests

2 participants