In Angular project we use RxStomp and we connect to STOMP endpoint with the watch
method. The documentation says
when a STOMP endpoint is subscribed it returns an Observable that will stream all received messages.
If I consider, that STOMP endpoint is subscribed, then I would expect there is also another function to unsubscribe from the STOMP endpoint, otherwise there is some amount of resources blocked, so memory leak occurs. Is this assumption right?
We have a list on FE side, which contains pagination (there are thousands of items on BE side and we cannot keep everything in memory) and for each of 15 items of the page we have one Observable created by watch
. Then we move to page 2 (in this moment I would expect all the watch
Observables are somehow cancelled) and we create another 15 Observables for another 15 items. When we then return to page 1, we create 15 new Observables for items, whose Observables have already been created, but are already lost (filtered out from array) without unsubscribing – is that a memory leak?