title: Something blocks my memory and the program hangs on GC.Collect() or GC.GetTotalAmountOfMemory(true)
body: <p><strike>
  whenever I call a <code>GC.Collect()</code> or <code>GC.GetTotalAmountOfMemory(true)</code> the whole program just hangs. Now, I know what you gonna say: Don't call <code>GC.Collect()</code> the GC takes care of itself. The problem is: It doesn't in my case, something hangs around in memory and the GC can't get rid of it.</p>
  
  <p>I've no idea what it could be (project is big/old). I hope someone knows how to obtain informations about what the GC tries to do (and obviously can't do) so that I can search for the problem or if something like a memory profiler could be of any help here (I've ANTS currently installed) and what I should search for.</p>
  
  <p>*edit 
  something I totally forgot: Sometimes when I call one of the two methods of GC, the memory usage increases by ~10 kilobytes / second</p>
  
  <p>*edit2
  I've to correct myself: GC.Collect() runs just fine. Only GC.GetTotalMemory(true) hangs. GC.GetTotalMemory(false) works just fine, too.</p>
  
  <p>*edit3
  and yup as some of you already said: It seems to be a finalizer somewhere. When I run WaitForPendingFinalizers() it just sits there, doing nothing aswell.
  </strike></p>
  
  <p>ok, now I'm completely confused: When I enter a <code>GC.GetTotalMemor(true)</code> or a <code>GC.WaitForPendingFinalizers()</code> into the immediate window of Visual Studio after I paused the debugger, the program hangs (<em>that's what I did the whole time...I feel stupid now</em>). When I add it to my usual source code and compile it, it works just fine.</p>
  
  <p>Sorry about the whole fuzz, seems the memoryleak has another cause. </p>