title: How to detect .NET WPF memory leak or GC long run?
body: <p>I have the next very strange situation and problem:</p>
  
  <ul>
  <li><p>.NET 4.0 application for diagram editing (WPF).</p></li>
  <li><p>Runs ok in my PC: 8GB RAM, 3.0GHz, i7 quad-core.</p></li>
  <li><p>While creating objects (mostly diagram nodes and connectors, plus all the undo/redo information) the TaskManager show, as expected, some memory usage "jumps" (up and down).</p></li>
  <li><p>These mem-usage "jumps" also remains executing AFTER user interaction ended. Maybe this is the GC cleaning/regorganizing memory?</p></li>
  <li><p>To see what is going on, I've used the Ants mem profiler, but somewhat it prevents those "jumps" to happen after user interaction.</p></li>
  </ul>
  
  <p>PROBLEM: It Freezes/Hangs after seconds or minutes of usage in some slow/weak laptos/netbooks of my beta testers (under 2GHz of speed and under 2GB of RAM). I was thinking of a memory leak, but...</p>
  
  <p>EDIT 1: Also, there is the case that the memory usage grows and grows until collapse (only in slow machines). </p>
  
  <ul>
  <li>In a Windows XP Mode machine (VM in Win 7) with only 512MB of RAM Assigned it works fine without mem-usage "jumps" after user interaction (no GC cleaning?!).</li>
  </ul>
  
  <p>EDIT 2: The problem is worse when the system has some other heavy programs running (like Visual Studio, Office and Web pages open). Not even the first symbol of diagram can be created while the memory usage takes off like a rocket to space (hundreds of MBs consumed in seconds). Anyone with similar experiences? what were they strategies?</p>
  
  <p>So, I really have a big trouble because I cannot reproduce the error, only see these strange behaviour (mem jumps), and the tool supposed to show me what is happening is hiding the problem (like the "observer's paradox").</p>
  
  <p>Any ideas on what's happening and how to solve it?</p>
  
  <p>EDIT 3: This screenshot of the Ants memory profiler shows that the huge consumption of ram (in crescendo) if from unmanaged resources.</p>
  
  <p><img src="https://i.stack.imgur.com/FJ4gf.png" alt="enter image description here"></p>
  
  <p>But, what can be consuming so much memory, so fast??!!!</p>