title: WPF Memory Usage #2
body: <p>I've asked a <a href="https://stackoverflow.com/questions/841602/wpf-memory-usage">question</a> about my memory management problem in WPF, but this is a different one about the same problem.
  I am using DotTrace trying to figure out what's going on. When I start up my app, I can see in Task Manager that it is taking 200MB. DotTrace says a total of 33MB. If I simply minimize the window and bring it back up, the memory footprint according to TM is about 25MB.</p>
  
  <p>I have a ListBox that shows peoples names and pictures. It shows up to 3000 people (I will work on paging, but that's not the point here). As I scroll down, I can see in TM that the memory increases rapidly. If I just keep scrolling up and down memory quick gets to 1GB. During the scroll there are no changes to the underlying data and there are no events of my own. If I minimize the window and bring it back up, memory drops from 1GB to 25MB. </p>
  
  <p>Before minimizing and seeing the memory go down in TM I took a snapshot with DotTrace and it shows the same amount of memory as before the scrolling - around 30MB or so.</p>
  
  <p>Can someone please explain to me what happens to memory when the app is minimized? Is the figure shown in Task Manager to be trusted?</p>
  
  <p>Thanks</p>
  
  <p>PS1:
  There's no change in behavior if I do or don't add this to my ListBox:</p>
  
  <pre><code>VirtualizingStackPanel.IsVirtualizing="True" 
  VirtualizingStackPanel.VirtualizationMode="Recycling"
  </code></pre>
  
  <p>PS2:
  I've put a button with the code, and the GC doesn't reclaim much if anything(it drops from, say 700MB to 680MB):</p>
  
  <pre><code>    GC.Collect();
      GC.WaitForPendingFinalizers();
  </code></pre>