REF_CACHE retains StateRefs created for components that have been unmounted
jefrailey opened this issue · comments
Joshua Frailey commented
Reproduction Steps
Please see my demo repository and follow the steps in the README.md
.
Description
The memory used by an application that uses useSwrv()
with the default time-to-live of 0
will increase as components that call useSwrv()
are created. This memory is never recovered because REF_CACHE
retains every StateRef
created during the life of an application. The retained StateRef
s are individually small, but retaining them forever causes a noticeable memory leak in long lived applications. As far as I can tell, it is not necessary to keep StateRef
s after the component that consumes them is destroyed.
Joshua Frailey commented
Closing as fixed by release 0.9.5.