ionic-team / stencil-store

Store is a lightweight shared state library by the StencilJS core team. Implements a simple key/value map that efficiently re-renders components when necessary.

Home Page:https://stenciljs.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Memory leak

cjorasch opened this issue · comments

I think this could lead to memory leaks where components are not able to be garbage collected.

It looks like elements are being removed from the update list when a state property is changed based on the forceUpdate result. This works if all properties are being changed frequently, but will not clear the list if the property never changes.

For example, if there is a global state property that never changes and a large number of elements use this state value when rendering, then the list will continue to grow over time and the elements will never be removed.

It seems like it would need some kind of global event when elements are disconnected or some event from the individual elements in order to dispose properly.