title: TaskFactory.StartNew -> System.OutOfMemoryException
body: <p>There around 1000 task running but sometimes i receive the following aout of memory exception thrown by task scheduler.
  What could be the reason and how to avoid it.</p>
  
  <pre><code>System.Threading.Tasks.TaskSchedulerException: An exception was thrown by a TaskScheduler. ---&gt; System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
     at System.Threading.Thread.StartInternal(IPrincipal principal, StackCrawlMark&amp; stackMark)
     at System.Threading.Thread.Start(StackCrawlMark&amp; stackMark)
     at System.Threading.Thread.Start(Object parameter)
     at System.Threading.Tasks.ThreadPoolTaskScheduler.QueueTask(Task task)
     at System.Threading.Tasks.Task.ScheduleAndStart(Boolean needsProtection)
     --- End of inner exception stack trace ---
     at System.Threading.Tasks.Task.ScheduleAndStart(Boolean needsProtection)
     at System.Threading.Tasks.Task.InternalStartNew(Task creatingTask, Object action, Object state, CancellationToken cancellationToken, TaskScheduler scheduler, TaskCreationOptions options, InternalTaskOptions internalOptions, StackCrawlMark&amp; stackMark)
     at System.Threading.Tasks.TaskFactory.StartNew(Action action, CancellationToken cancellationToken, TaskCreationOptions creationOptions, TaskScheduler scheduler)
     at App.StartReadSocketTask()
  </code></pre>