Skip to content

Bug: Memory leak for input element in react 18.2.0 and 16.14.0 #27289

@mshmyw

Description

@mshmyw

React version: 16.14.0 and 18.2.0

Steps To Reproduce

I can give a demo more obvious, the demo: https://codesandbox.io/s/admiring-khayyam-3s64gq?file=/src/App.tsx

Steps To Reproduce:

  1. a simple demo can be found Here: https://codesandbox.io/s/admiring-khayyam-3s64gq?file=/src/App.tsx
  2. running GC and Take a heap snapshot
    image
  3. Click 'open Modal click for test memory leak (has large input items)' and open modal
  4. focus any input item
    image
  5. close modal
  6. refresh state for click 'refresh state '
  7. running GC and Take a heap snapshot
    image

and after that you can found large detached input element exist

Link to code example:
https://codesandbox.io/s/admiring-khayyam-3s64gq?file=/src/App.tsx

The expected behavior

hope some one can help resolve this

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: UnconfirmedA potential issue that we haven't yet confirmed as a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions