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

When using setInterval to implement a counter in Vue3, the Dom Nodes are incremented, but there is no such problem in Vue2 #12672

Closed
wuzhibo0902 opened this issue Jan 9, 2025 · 2 comments

Comments

@wuzhibo0902
Copy link

Vue version

3.5.13

Link to minimal reproduction

https://play.vuejs.org/#eNp9UsFu2zAM/RVChzVFgzjDduqcYFvRQ3fYhm1HXRyHydTKkiBRaQDD/15KqlOjSHsxpMfHp/do9uKbc4tDRHEt6tB65QgCUnRraVTnrCfoweMOBth528EFUy+kkaa1JhCY2MEq1WfLy4RqJCDVoX+hBGo83dhoCD1zZ5ewWkMvDRQiQ/zeXaoeGj2blCGpLxiMeHWVgGEOH5fL9NAwlbfurHqrsfEn3fxW6ayrkpMT8oWwc7oh5BtAvVWHfOD2onkNfZ9TDtzJhGpk1BsP1eumehOJrIGvrVbtw0qKaXgp1vk6StdVYT/3fjCb4L6U75tqp6xZzLqzWqPJupqEE3NBgUe2U/vFfbCG/3cekxSt7ZzS6H85UjxSKThzMSBFo7V9/JEx8hHnI97+x/bhDH4fjgmT4rfHwJNHKU41zr5HKuXbvz/xyOdTsbPbqJn9TvEPBqtj8lho36PZsu0JL7u9y1urzP5fuD0SmjCGSkbLGpXcvMk370R/sftp8Tn38faI4QmqHBCu

Steps to reproduce

  1. Open Chrome Developer tools (F12)
  2. Open More tools -> Performance monitor
  3. Make sure the Dom Nodes option is selected
  4. When the number of dom nodes no longer changes, click start counter button to start the counter, the number of dom nodes will increase as the counter is executed each time.
  5. Click stop counter button to stop the counter, the number of dom nodes will stop growing.
    dom_nodes

What is expected?

The number of Dom nodes should remain constant while the counter is executing.

What is actually happening?

The number of dom nodes are increased as the counter is executed each time. This will cause a memory leak.

System Info

No response

Any additional comments?

No response

@edison1105
Copy link
Member

Kapture.2025-01-09.at.10.40.09.mp4

Please make sure to operate in Chrome incognito mode or disable vue-devtools.
After manually clicking collect garbage, the DOM nodes will be reclaimed, which is not a memory leak.

@wuzhibo0902
Copy link
Author

Kapture.2025-01-09.at.10.40.09.mp4
Please make sure to operate in Chrome incognito mode or disable vue-devtools. After manually clicking collect garbage, the DOM nodes will be reclaimed, which is not a memory leak.

I found that the js heap size did not increase, perhaps Chrome's counting of the number of dom nodes is inaccurate in some cases. Thank you!

@edison1105 edison1105 closed this as not planned Won't fix, can't repro, duplicate, stale Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants