morphic.js icon indicating copy to clipboard operation
morphic.js copied to clipboard

subtle (and probably premature) note about destroying mechanism (potential memory leaks source)

Open davidedc opened this issue 10 years ago • 0 comments

looks like the current "destroy" implementations are non-recursive. One (or a few) nodes are severed from the tree.

While this removes an entire branch from the world in terms of visibility and interaction, there could be a memory leak if destroyed morphs "down the branch" are targets of living morphs, or if callbacks from living objects reference them.

A recursive destroy would give the chance to check such links (which could prevent the morphs from being garbage-collected) and decide what to do about them.

Probably not a material concern, but if a leak is observed, this could be a place where it could come from...

davidedc avatar Nov 24 '15 20:11 davidedc