Skip to content

[BUG] Memory leak when scrolling animated items in a virtualized list. #3241

@dzborowskipbx

Description

@dzborowskipbx

2. Describe the bug

While scrolling the virtualized list, I noticed the occurrence of memory leaks when using motion.div animation. I noticed that if I remove the animation definition from motion.div (initial={{ opacity: 0 }}, animate={{ opacity: 1 }}) the memory leak stops.

3. IMPORTANT: Provide a CodeSandbox reproduction of the bug

https://codesandbox.io/p/sandbox/nj8cqp?file=%2Fsrc%2FApp.js
https://nj8cqp.csb.app/

4. Steps to reproduce

Steps to reproduce the behavior:

  1. Go to https://nj8cqp.csb.app/
  2. Open chrome devtools -> performance monitor
  3. Scroll through the list of items on the top-down page a few times.
  4. The list of DOM Nodes in performance monitor grows and does not fall even after time and manual GC.

5. Expected behavior

Information telling what I should change in the client code to make the memory leak stop or fixing the bug causing it in the library.

6. Video or screenshots

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions