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

ServiceWorker release references to completed tasks. Fixes #854 #869

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dhohlin
Copy link

@dhohlin dhohlin commented Mar 24, 2018

Prevent OutOfMemoryException

@cvocvo cvocvo mentioned this pull request Jul 30, 2018
@@ -179,6 +179,9 @@ public void Start ()

// Let's wait for the continuation not the task itself
toSend.Add (cont);

// release references to completed tasks
toSend.RemoveAll(task => task.IsCompleted);
Copy link

@houseofcat houseofcat Apr 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got pinged from a comment I opened 4 years ago.

This should help but I believe you want to check if Task.IsFaulted (as well) GC will throw a UnobservedTaskException if the error is not handled. Or you could add an AppDomain UnobservedTaskException handler.

https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.task.iscompleted?view=net-5.0

Completed => RanToCompletion, Faulted, or Canceled

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