title: Garbage collections improvements in CLR 4.0
body: <p>Recently I was running the example provided by <a href="http://www.simple-talk.com/dotnet/.net-framework/the-dangers-of-the-large-object-heap/" rel="nofollow">Andrew Hunter on his blog "The Dangers of the Large Object Heap"</a> compiled against .NET 4 and I got the following numbers:</p>
  
  <blockquote>
    <p>With large blocks: 622Mb allocated<br/>
    With large blocks, frequent garbage
    collections: 582Mb allocated<br/> Only
    small blocks: 1803Mb allocated<br/> With
    large blocks, large blocks not
    growing: 630Mb allocated</p>
  </blockquote>
  
  <p>If the same code is compiled against.NET 2.0 I got almost the numbers mentioned in article:</p>
  
  <blockquote>
    <p>With large blocks: 21Mb allocated<br/>
    With large blocks, frequent garbage
    collections: 26Mb allocated<br/> Only small
    blocks: 1811Mb allocated<br/> With large
    blocks, large blocks not growing:
    707Mb allocated</p>
  </blockquote>
  
  <p>What is the cause of such dramatical improvement?</p>
  
  <p>Code is compiled for x86 platform and is run on Windows 7</p>