In several of the tutorials and documentation I've read about Angular observables, I've seen a lot of warnings on how failing to unsubscribe from a subscription can create memory leak (unless using the async pipe in the component's template).
I have some support classes in my app where I create custom observables, but I was wondering if its important to unsubscribe to them if both the observable and all the subscribers go out of scope. For example, I have a parent class which contains a map of child objects in an array. The parent subscribes to an observable for each of its children to detect changes in the "value" property, and the parent recalculates it's 'total' property whenever the child changes its value.
Then say the parent object goes out of scope, and typically the parent and all the children would be garbage collected so long as no live references to any of the children are hanging around. Is it necessary to for the parent to unsubscribe to each of childchange subscriptions in order for the subscription to be release? Or does the subscription itself get garbage collected when either the subsscribers or the observed object go out of scope? Or will the active subscription itself keep the parent alive, and thus all the children alive?