rrweb
rrweb copied to clipboard
[Bug]: stop recording have memory leak
Preflight Checklist
- [X] I have searched the issue tracker for a bug report that matches the one I want to file, without success.
What package is this bug report for?
rrweb
Version
v2.0.0-alpha.18
Expected Behavior
stop record no memory growth
Actual Behavior
Steps to Reproduce
- create Vue project and create button
- click button start record
- click again stop record
- no memory growth
const handleClick = () => {
if (tmp) {
tmp()
tmp = null
console.error('destroy rrweb')
} else {
tmp = record({
emit: function () {}
})
console.error('init rrweb')
}
}
Testcase Gist URL
No response
Additional Information
No response
record调用函数后会返回一个方法, 可以取消继续记录
record调用函数后会返回一个方法, 可以取消继续记录 @czfadmin 可以看到我上面的调用函数,第二次点击的时候完成卸载并执行返回方法,记录已被取消,但是内存仍然还被持有
会不会tmp是没有使用ref导致的 @RenaultZC
会不会tmp是没有使用ref导致的 @RenaultZC
@czfadmin 这里为什么需要使用 ref?返回的不是一个 function 吗?而且我这里完成 function 执行之后就释放了 tmp 的内存