title: Best way to resolve OutOfMemoryException? (C#)
body: <p>I'm using C#, .Net 4.6.x, and the Telerik controls for WinForms in Visual Studio 2017 RC. The application consists of a "main" window that uses a RadRibbon and a RadPageView.  The RadPageView is dynamically populated with pages based on a search form which is the first page, or by a user requesting a new blank form.  The other pages are inherited from RadPageViewPage and have an additional property called "TQC".  TQC refers to a custom control that loads on the page.</p>
  
  <p>The TQC has several dropdownlists and text areas in RadPageViewPages that are all contained in a RadPageView control within the TQC object.  It doesn't bind any data to its controls until its RPVP (the class inheriting RadPageViewPage) is Selected. One of the dropdownlists contains 200 or so entries when it's populated (a list of accounts).  </p>
  
  <p>The problem I've run into is that when the outer RadPageView Remove()s a page, the memory taken by that page isn't freeing up, to the order of a couple hundred megabytes.  This is problematic, as the target machines have between 4GB and 8GB of RAM. I tried setting the data objects that populate the controls to null as part of the closing event, but nothing changed. I also tried explicitly calling the Dispose() method on all descendants of the RadPageViewPage as below:</p>
  
  <pre><code>private void rpvQtabs_PageRemoved(object sender, RadPageViewEventArgs e)
      {
  
          foreach (TQC c in e.Page.Controls)
          {                
              foreach (Control ca in c.Controls)
              {
                  foreach (Control cac in ca.Controls)
                  {
                      cac.Dispose();
                  }
                  ca.Dispose();
              }
              c.Dispose();
          }
          e.Page.Dispose();           
      }
  </code></pre>
  
  <p>I'm still getting a crazy huge memory leak, and if more than 5 tabs are viewed by the user (even if they close the page), an OutOfMemoryException is soon to follow.  I tried attaching the Performance Profiler, but it crashes on the attempt.  VS 2015 isn't an option at the moment.  How can I ensure that the pages are disposed properly, or reduce the memory footprint on the extremely large dropdownlists?  This is our first foray into using Telerik. </p>
  
  <p>In response to questions in the comments:</p>
  
  <p>The object that throws the error is usually relatively random and depends on which accounts are loaded.  It's not anything infinitely recursive. This is how the control's is originally loaded (using a special connection class):                                    </p>
  
  <pre><code>public static List&lt;Account&gt; List(bool includeDefaults = true)
      {
          //search
          var rs = new List&lt;Account&gt;();
          string q = "select distinct r.ID, r.name from db.addressbook r";
          DataTable dt = new DataTable();
          using (var cmd = new CustomConnectionClass())
          {
              cmd.Safety.Off();
              dt = cmd.ExecuteDirectQuery(q);
          }
  
          foreach (DataRow r in dt.Rows)
          {
              var a = new Account();
              a.ID = long.Parse(r[0].ToString());
              a.Name = r[1].ToString();
              rs.Add(a);
          }
          rs = rs.OrderBy(t =&gt; t.ID).ToList();
          var n = new Account();
          n.ID = 0;
          n.Name = "Generic Account";
          var o = new Account();
          o.ID = 999999;
          o.Name = n.Name;
          rs.InsertRange(0, new Account[] { n, o });
          return rs;
  
      }
  </code></pre>