This twitter conversation gets me wondering about these lines, where we add an event listener to each parent for a child signal, but those event listeners are not removed (only the one that fires removes itself).
It might be useful for getSignalPr(..) to expose a trigger to call removeEventListener(..), so that lines 155 and 164 can remove the event handlers for all parent signals. That should ensure the promises for each child signal are GC'd, even though the child signals should already be able to be GC'd.
Also, it might be worth exploring if a WeakMap could possibly be more useful here or not, from the GC perspective.
This twitter conversation gets me wondering about these lines, where we add an event listener to each parent for a child signal, but those event listeners are not removed (only the one that fires removes itself).
It might be useful for
getSignalPr(..)
to expose a trigger to callremoveEventListener(..)
, so that lines 155 and 164 can remove the event handlers for all parent signals. That should ensure the promises for each child signal are GC'd, even though the child signals should already be able to be GC'd.Also, it might be worth exploring if a WeakMap could possibly be more useful here or not, from the GC perspective.