daybrush / selecto

Selecto.js is a component that allows you to select elements in the drag area using the mouse or touch.
https://daybrush.com/selecto
MIT License
2k stars 81 forks source link

Memory leak #171

Open axetroy opened 2 months ago

axetroy commented 2 months ago

Environments

Description

I found that after each instantiation, there would be Selecto instances that were not destroyed and kept occupying memory.

I have such a scenario, which often needs to be created and then destroyed, which brings memory leaks to my application.

Here are the steps I took to reproduce:

  1. Open story book welcome page and open devTool
  2. Trigger GC in devTool
  3. Take memory snapshot 1
  4. Open another page in storage book (eg. Select in real time)
  5. Go back to story book welcome page
  6. Trigger GC in devTool
  7. Take memory snapshot 2

Snapshot 1:

截屏2024-06-01 13 14 23

Snapshot 2:

截屏2024-06-01 13 15 15

Diff snapshot:

截屏2024-06-01 13 11 07

Theoretically, when the page is switched, the Selecto object should be destroyed and recycled by GC, but in fact it is not.

Selecto@295827 Still accessible