The issue has been closed

posted by xiaoiver about 2 years ago 
嗯嗯,看来每次渲染之前应该把之前的 animation 对象都销毁。
posted by pearmini about 2 years ago
posted by hustcc about 2 years ago 
和这个是同一问题吗? #4796 是否需要发包解决?
不是一个问题,#4796 已经解决了。
posted by pearmini about 2 years ago
测试代码如下:
setInterval(() => {
chart.render();
}, 100);
仔细排查了一下发现开启 grid 之后才会造成 OOM,而关闭就好了:
const line = chart
.line()
.data({
type: 'fetch',
value: 'data/aapl.csv',
})
.encode('x', 'date')
.encode('y', 'close')
.axis({
x: { grid: false },
y: { grid: false }
});
下图为关闭 grid 后间隔 30s 的截图,定时器 100ms 重绘一次。可以看出内存占用大小稳定,没有爆炸式增长:
<img width="1211" alt="截屏2023-04-26 下午7 34 33" src="https://user-images.githubusercontent.com/3608471/234562905-638a8652-7319-430e-959b-8f668a4a318c.png">
而开启 grid 后造成大量 Animation 未被回收的原因是 G2 context.transitions
没有收集到 GUI grid 组件的 Animation 对象。
posted by xiaoiver almost 2 years ago