Closed markphilpot closed 3 years ago
@markphilpot Actually yes, a memory leak! Good catch 👍
The bug is in this line: https://github.com/haltu/muuri/blob/master/src/Packer/Packer.js#L81.
It should say this instead: if (layout) delete this._layouts[layoutId];
Will fix asap.
@markphilpot I created a pull request with a fix here: https://github.com/haltu/muuri/pull/486. Would you mind validating that the fix works in your use case?
@markphilpot I created a pull request with a fix here: #486. Would you mind validating that the fix works in your use case?
Yes, the updated delete
cleans up the layouts correctly. Looks good 👍
This should be now fixed in the latest release: https://github.com/haltu/muuri/releases/tag/0.9.5
In my app where we create (and clean up) lots of Grid elements, the static
defaultPacker
seems to retain every layout (including references to the dom item elements). This seems to result in memory being retained over time.On reading the code, I can't tell how
Grid.defaultPacker._layouts
ever gets cleaned up. Do I just to periodically recreate thedefaultPacker
instance?