Bug Report
Current Behavior
Under certain common conditions, use of the shareReplay operator will cause memory leaks. This is similar to what was documented in #5034, but although that issue was marked as resolved by #5044, it can be observed in the linked example that the problem persists to a considerable degree.
Reproduction
https://stackblitz.com/edit/angular-a27w1c
https://angular-a27w1c.stackblitz.io/
- Open up https://angular-a27w1c.stackblitz.io/ in Chrome
- Use the checkboxes to create and destroy each of the components.
- Once they are all destroyed, use the devtools Memory tab to take a heap snapshot, and search for the word "Component".
- Observe that while the
AsyncSingleComponent was indeed destroyed, the SyncComponent and the AsyncContinuousComponent have stuck around.
Expected behavior
Each of the three components should have their class instances garbage-collected.
Environment
- See Stackblitz above
- RxJS version: 6.6.3