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

[Bug]: stop recording have memory leak #1628

Open
1 task done
RenaultZC opened this issue Jan 16, 2025 · 4 comments
Open
1 task done

[Bug]: stop recording have memory leak #1628

RenaultZC opened this issue Jan 16, 2025 · 4 comments
Labels
bug Something isn't working

Comments

@RenaultZC
Copy link

Preflight Checklist

  • 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

image

Steps to Reproduce

  1. create Vue project and create button
  2. click button start record
  3. click again stop record
  4. 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

@RenaultZC RenaultZC added the bug Something isn't working label Jan 16, 2025
@czfadmin
Copy link

record调用函数后会返回一个方法, 可以取消继续记录

@RenaultZC
Copy link
Author

record调用函数后会返回一个方法, 可以取消继续记录
@czfadmin 可以看到我上面的调用函数,第二次点击的时候完成卸载并执行返回方法,记录已被取消,但是内存仍然还被持有

@czfadmin
Copy link

会不会tmp是没有使用ref导致的 @RenaultZC

@RenaultZC
Copy link
Author

会不会tmp是没有使用ref导致的 @RenaultZC

@czfadmin 这里为什么需要使用 ref?返回的不是一个 function 吗?而且我这里完成 function 执行之后就释放了 tmp 的内存

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants