Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid leaking task continuations #766

Merged
merged 5 commits into from
Jul 5, 2018
Merged

Avoid leaking task continuations #766

merged 5 commits into from
Jul 5, 2018

Conversation

danielcweber
Copy link
Collaborator

Some registration of continuations on tasks are possibly never unregistered, which may lead to memory leaks if the tasks are long lived. This PR attemps to fix this.

…avoid leaking the continuation on long-lived tasks.
…void a leaking continuation if the task lives longer than the Sink.
…is is a bit more involved. The continuation must not be registered before a subscription happens because it might leak on long lived tasks. So instead of registering a continuation on a task once and forwarding the results to an AsyncSubject, we construct an Observable that registers the continuation for each subscription. Memory performance might of course go down if a lot of subscriptions happen on a task, but it won't leak.
@danielcweber danielcweber merged commit 0bf8cff into dotnet:master Jul 5, 2018
@danielcweber danielcweber deleted the AvoidLeakingTaskContinuations branch July 5, 2018 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants