Freeing memory once a derivation is no longer needed
Open
- Dominant language
- JavaScript
- Stars
- 518
- Forks
- 23
- PR merge metrics
- No merged PRs in 30d
Description
Consider this code:
```
a = atom(5)
d = derivation(() => a.get() + 1)
d.get()
```
A side effect of `d.get()` is setting `a._children[0]` to point to `d`.
When I'm done with `d`, how do I get rid of that pointer?
Right now I use derivations in my React components which call `.get()` on derivables outside of the component. When the component is unmounted, the pointers like `a._children[0]` above are causing a major memory leak, because the entire component is sticking around as the closure-context to the un-garbage-collectable derivation.
Contributor guide
Assessment
This issue has not been assessed yet.