title: App that uses Task Scheduler quickly runs out of memory
body: <p>The app parses files within some directory, while new files are being added to the directory. I uses ConcurrentQueue and tried to split work to the number of cores. So if there are files to process - it should process up to 4(cores) files concurrently. 
  Yet the app runs OOM within seconds, after processing 10-30 files. I see the memory consumption grow to ~1.5GB quickly, than OOM error appears. 
  I'm to task scheduler, so I'm probably doing something wrong. 
  File parsing is done by running some .exe on the file, which uses &lt;5mb or ram.
  Task scheduler runs every time timer thread elapses. But it runs OOM even before timer elapsed for 2nd time.</p>
  
  <pre><code>private void OnTimedEvent(object source, ElapsedEventArgs e)
      {
          DirectoryInfo info = new DirectoryInfo(AssemblyDirectory);
          FileInfo[] allSrcFiles = info.GetFiles("*.dat").OrderBy(p =&gt; p.CreationTime).ToArray();
          var validSrcFiles = allSrcFiles.Where(p =&gt; (DateTime.Now - p.CreationTime) &gt; TimeSpan.FromSeconds(60));
          var newFilesToParse = validSrcFiles.Where(f =&gt; !ProcessedFiles.Contains(f.Name));
          if (newFilesToParse.Any()) Console.WriteLine("Adding " + newFilesToParse.Count() + " files to the Queue");
          foreach (var file in newFilesToParse)
          {
              FilesToParseQueue.Enqueue(file);
              ProcessedFiles.Add(file.Name);
          }
          if (!busy)
          {
  
              if (FilesToParseQueue.Any())
              {
                  busy = true;
                  Console.WriteLine("");
                  Console.WriteLine("There are " + FilesToParseQueue.Count + " files in queue. Processing...");
              }
              var scheduler = new LimitedConcurrencyLevelTaskScheduler(coresCount); //4
              TaskFactory factory = new TaskFactory(scheduler);
              while (FilesToParseQueue.Any())
              {
                  factory.StartNew(() =&gt;
                  {
                      FileInfo file;
                      if (FilesToParseQueue.TryDequeue(out file))
                      {
                          //Dequeue();
                          ParseFile(file);
                      }
                  });
              }
              if (!FilesToParseQueue.Any())
              {
                  busy = false;
                  Console.WriteLine("Finished processing Files in the Queue. Waiting for new files...");
              }
          }
      }
  </code></pre>