title: MVC application memory management
body: <p>I would like to get more information regarding memory management in the ASP.NET MVC (5) apps.</p>
  
  <p>For the sake of simplicity, let's say that we have a simple page with angular controller, which only makes a <code>http.get()</code> call towards my <code>api controller</code> to retrieve 70 000 items of  <code>IEnumerable&lt;CustomItem&gt;</code> and afterwards outputs the result to the page (paging is implemented).</p>
  
  <p>When looking at my diagnostic tools (memory profiler) I can see memory rising from 50 MB (starting point) up to 300 MB (once all the data is retrieved).</p>
  
  <p><strong>Here is the thing I don't understand:</strong><br>
  Why when I open the same page with different browser at the same time (trying to simulate that more users are visiting the page at the same time), the memory consumption for second user does not rise by another 250 MB but it remains the same even though the data has been loaded again?</p>
  
  <p>I was under impression, that <code>ApiController</code> is not shared among users but new instance is being created for every user. If I am right and it's really the case, how come that when 70 000 more items arrived the memory consumption didn't change?</p>
  
  <p>Any articles or explanations would be highly appreciated.</p>
  
  <p><strong>Addition 1:</strong><br>
  My api controller is rerieving data from <code>SharePoint</code> and therefore I have to pass all 70 000 records at once to my angular component, which afterwards implements pagination. In other words, my components loads only once all the data (70 000 records) and afterwards displays only portion at the time (otherwise if I used <code>data-ng-repeat</code> on 70 000 items my browser used to freeze). </p>
  
  <p>I can surely show my <code>ApiController</code> code if necessary, but really its just 3 lines of code which return <code>IEnumerable&lt;CustomItem&gt;</code> which only holds three string properties. This is how it looks like:</p>
  
  <pre><code>public class SharepointFile
  {
      public string FileType { get; set; }
      public string FileName { get; set; }
      public string FilePath { get; set; }
  }
  </code></pre>