facebookexperimental/Recoil

Memory leak when using atomFamily/selectorFamily

Open

#366 opened on Jun 19, 2020

View on GitHub
 (22 comments) (13 reactions) (1 assignee)JavaScript (1,151 forks)batch import
help wantedperformance

Repository metrics

Stars
 (19,428 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

Hello there,

The resources created by atomFamily and selectorFamily are not being properly freed when the specific key changes or if the component using the related RecoilState<T> unmounts.

Since I believe that memory management isn't properly implemented yet, both utils should be marked as _UNSAFE.

https://codesandbox.io/s/cranky-booth-penix?file=/src/App.js

Contributor guide