Skip to content

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

Open
dhohlin wants to merge 2 commits into
Redth:masterfrom
dhohlin:master
Open

ServiceWorker release references to completed tasks. Fixes #854#869
dhohlin wants to merge 2 commits into
Redth:masterfrom
dhohlin:master

Conversation

@dhohlin

@dhohlin dhohlin commented Mar 24, 2018

Copy link
Copy Markdown

Prevent OutOfMemoryException

@cvocvo cvocvo mentioned this pull request Jul 30, 2018
toSend.Add (cont);

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

@tristan-hyams tristan-hyams Apr 21, 2021

Copy link
Copy Markdown

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