question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Memory leak when using atomFamily/selectorFamily

See original GitHub issue

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

Screen Shot 2020-06-19 at 12 07 12

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:10
  • Comments:19 (9 by maintainers)

github_iconTop GitHub Comments

4reactions
mondaychencommented, May 24, 2021

Just FYI we are working on the memory issue with use of family utils, and should have something to announce about it in the near future.

4reactions
trivigycommented, Nov 9, 2020

Could this be related? I am getting this warning and cannot seem to figure out a way to get rid of it.

Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in a useEffect cleanup function.
Read more comments on GitHub >

github_iconTop Results From Across the Web

atomFamily — Jotai, primitive and flexible state management ...
Unless you explicitly remove unused params, this leads to memory leaks. This is crucial if you use infinite number of params.
Read more >
how to implement typical use-case with recoil - Stack Overflow
Potentially, my list just needs to be state vs from a selector family query and it can get set from different places where...
Read more >
/docs/utils/atom-family.mdx | jotai@v1.6.5 | Deno
Unless you explicitly remove unused params, this leads to memory leaks.This is crucial if you use infinite number of params.
Read more >
atomFamily(options) - Recoil
For dynamic defaults based on other state use a selectorFamily() , which also has access to the parameter value. Don't just use selector()...
Read more >
recoil | Yarn - Package Manager
Change Log. UPCOMING. Add new changes here as they land. 0.7.6 (2022-10-06). Workaround for React 18 environments with nested renderers that don't support ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found