title: How to dispose all objects in an eternal WHILE loop in a console appllication in C#
body: <p>I have to check database for some scheduled task when it is his time do something.</p>
  
  <p>But when it has run (without calling any other function), it occupies my hard drive every 5 min, 70MB. Is this normal? How can I solve this problem?</p>
  
  <pre><code>static void Main(string[] args)
  {
      //dhpGroup_kukuEntities _efEntities = new dhpGroup_kukuEntities();
      while (true)
      {
              DateTime ServerNOW= DateTime.Now;
  
              using (dhpGroup_kukuEntities _efEntities = new dhpGroup_kukuEntities())
              {
                  List&lt;Schedual_JSON&gt; ListSchedual = new List&lt;Schedual_JSON&gt;();
                  var a =
                      _efEntities.Schedual_JSON.Where(
                          x =&gt;
                              x.SCHJS_DateTimeSchedual.Value.Year == ServerNOW.Year &amp;&amp;
                              x.SCHJS_DateTimeSchedual.Value.Month == ServerNOW.Month &amp;&amp;
                              x.SCHJS_DateTimeSchedual.Value.Day == ServerNOW.Day &amp;&amp;
                              x.SCHJS_DateTimeSchedual.Value.Hour == ServerNOW.Hour &amp;&amp;
                              x.SCHJS_DateTimeSchedual.Value.Minute == ServerNOW.Minute &amp;&amp;
                              x.SCHHS_SendToThread == false).ToList();
  
                  if (a.Count &gt; 0)
                  {
                      for (int i = 0; i &lt; a.Count; i++)
                      {
                          Console.WriteLine("One Task Found!");
                      }
  
                      ThreadPool.QueueUserWorkItem(o =&gt; GetSchedualList(a));
  
                      foreach (var VARIABLE in a)
                      {
                          Console.WriteLine("One Scudule Regarding to User({0}) With {1} Channel(s) and {2} files Run to BasicThread", _efEntities.AspNetUsers.FirstOrDefault(x =&gt; x.Id == VARIABLE.SCHJS_UserID).UserName, getChannelCount(VARIABLE), getFileCount(VARIABLE));
                          VARIABLE.SCHHS_SendToThread = true;
                      }
  
                      _efEntities.SaveChanges();
                  }
              }
  
              System.GC.Collect();
          }
  }
  </code></pre>