title: Memory Leak using StreamReader and XmlSerializer
body: <p>I've been googling for the past few hours and trying different things but can't seem to the bottom of this....</p>
  
  <p>When I run this code, the memory usage continuously grows. </p>
  
  <pre><code>while (true)
  {
      try
      {
          foreach (string sym in stringlist)
          {
              StreamReader r = new StreamReader(@"C:\Program Files\" + sym + ".xml");
              XmlSerializer xml = new XmlSerializer(typeof(XMLObj), new XmlRootAttribute("rootNode"));
              XMLObj obj = (XMLObj)xml.Deserialize(r);                       
              obj.Dispose();
              r.Dispose();
              r.Close();
          }
      }    
      catch(Exception ex) 
      {
          Console.WriteLine(ex.ToString()); 
      }
      Thread.Sleep(1000);
      Console.Clear();
  }
  </code></pre>
  
  <p>XMLObj is a custom object</p>
  
  <pre><code>[Serializable()]
  public class XMLObj: IDisposable
  {
      [XmlElement("block")]
      public List&lt;XMLnode&gt; nodes{ get; set; }
  
      public XMLObj() { }
  
      public void Dispose()
      {
          nodes.ForEach(n =&gt; n.Dispose());
          nodes= null;
  
          GC.SuppressFinalize(this);
      }
  }
  </code></pre>
  
  <p>I've tried adding in GC.Collect(); but that doesn't seem to do anything.</p>