Skip to content

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

@tristan-hyams tristan-hyams 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