An open API service indexing awesome lists of open source software.

https://github.com/xpl/r3f-leak

R3F leaks the last root's state via module-level variables in the render loop
https://github.com/xpl/r3f-leak

Last synced: 17 days ago
JSON representation

R3F leaks the last root's state via module-level variables in the render loop

Awesome Lists containing this project

README

          

# How to run

```
npm i
npm run dev
```

# What happens

R3F leaks the last root's state via module-level variables in the render loop.

After all Canvas components unmount and _roots is empty, the module-scoped `state`, `subscribers`, and `subscription` variables in the loop/update functions still reference the last rendered root's store state — preventing GC of the entire fiber tree and any bridged context values.

Repro: click the button, wait for all 16 cycles, force garbage collection in DevTools, observe last value stays "alive".

Screenshot 2026-04-30 at 4 28 35 PM

# Bug report / PR fix

https://github.com/pmndrs/react-three-fiber/pull/3747