reselect
reselect copied to clipboard
defaultMemoize leak the memory
Hi, since the defaultMemoize will store the memoized data in a closure, it won't ever be collected, even if the original instance is lost and that code won't ever be reached. Would be better to use WeakMap and fallback to closure if it's not supported.
I'm not sure I follow your thinking here. Would you expect this to leak memory?
const createSelector = require('reselect').createSelector
const generate = () => [...Array(100000).keys()]
while(true) {
const state = { stuff: generate() }
const mySelector = createSelector(state => state.stuff, stuff => stuff.map(x => x * 2))
const values = mySelector(state)
}
Closing due to inactivity