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

[v5] 多次运行动画存在内存泄漏情况 #4843

Closed
xiaoiver opened this issue Mar 28, 2023 · 4 comments
Closed

[v5] 多次运行动画存在内存泄漏情况 #4843

xiaoiver opened this issue Mar 28, 2023 · 4 comments
Assignees
Labels
Milestone

Comments

@xiaoiver
Copy link
Contributor

xiaoiver commented Mar 28, 2023

类似问题:#4796

复现方法:timingKeyframe 容器设置 iterationCount: Infinity 即可

截图展示了运行一段时间后的三次内存信息,可以看出一直在增长:

截屏2023-03-28 下午5 17 42

原因是存在大量未被销毁的 Path 对象。应该是形变动画结束后,没有调用 path.destroy() 销毁。

@pearmini
Copy link
Member

这里组件会有相同的问题吗?比如组件的文本。

@pearmini pearmini added this to the 5.0.2 milestone Mar 29, 2023
@xiaoiver
Copy link
Contributor Author

xiaoiver commented Apr 3, 2023

该问题 @antv/g@5.16.13 已修复,G2 不需要做任何修改。目前只需要将图形从画布中移除就可以得到及时回收:

shape.remove();

下图为一个无限执行的动画效果验证,相邻两个 memory snapshots 间隔 30s。可以看出内存已经能够及时得到回收:

截屏2023-04-03 下午1 21 54

@xiaoiver xiaoiver closed this as completed Apr 3, 2023
@hustcc
Copy link
Member

hustcc commented Apr 23, 2023

这个内存泄漏的原因是什么?

@pearmini
Copy link
Member

这个内存泄漏的原因是什么?

shape 从场景树移除但是没有调用 shape.destroy 的时候没有销毁。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants