0

What is the impact of not unsubscribing from a RxJS Stream after it was completed? e.g. Angular 2 Http request.

Can this lead to a memory leak?!

MasterOfPuppets
  • 173
  • 3
  • 10

1 Answers1

1

You don't actually have to unsubscribe from http requests because they complete immediately after the response/error arrived (and returned to the subscriber).

The impact will be the Observable / Subscription javascript variables not being garbage collected because they'll leave a reference, and will in turn create a memory leak.

It may or may not affect performance, depends on how many times a new Observable/Subscription is created and "left to rot".

Amit
  • 4,274
  • 21
  • 25