question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Memory leak in subscriptions

See original GitHub issue

Steps to reproduce: Subscribe to a channel, then call subscription.unsubscribe().

Expected: A subscription is completely removed.

Actual result: Subscriptions stored in an internal Centrifuge._subs object and they are never removed.

I create a single page application and while a user is navigated between pages the app unsubscribes from channels required on a given page and subscribes to a new channels on a next page. It turns out that number of subscriptions stored in Centrifuge._subs increases unless a user reloads a browser tab.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
FZambiacommented, Mar 29, 2020

@vladvelici hello, the problem that @aleksei-savitski-softswiss described relates to a scenario where many subscriptions to different channels get created on the same page and no page reload happens for a long time (SPA application). In this case all once created subscriptions stay in internal _subs map of client and there is no public way to release them even though we know that we don’t need those subscriptions anymore. Just created pr that should fix this.

0reactions
FZambiacommented, Apr 2, 2020

Released in 2.5.0, let’s see how it goes

Read more comments on GitHub >

github_iconTop Results From Across the Web

Preventing Angular Subscription Memory Leaks | Jake Cyr
A simple way to avoid this is to save a reference to the subscription and unsubscribe in the ngOnDestroy lifecycle method. For example:...
Read more >
Angular- How to avoid Memory Leaks from Subscriptions?
Failing to Unsubscribe can cause memory leaks. Solution. There are many solutions on to this problem. But the most elegant and error-proof solution...
Read more >
How to prevent memory leak of subscriptions creation when ...
there is a memory leak beacuse each time pageChange emits a new subscription is created. That subscription will be completed after one emission ......
Read more >
RxJS: Why memory leaks occur when using a Subject
It's not uncommon to see the words 'unsubscribe', 'memory leaks', 'subject' in the same phrase when reading upon RxJS-related materials.
Read more >
Avoid memory leaks when subscribing to RxJS Observables ...
[01:32] The problem is that we have a memory leak here. The observable in our numbersService continues to emit values because the NumberService...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found