SYSK 18: CLR “discrimination” of large objects

Did you know that large objects (those that are 85,000 bytes or larger) are allocated from a special large object heap. Objects in this heap are finalized and freed just like the small objects. However, large objects are never compacted because shifting 20,000-byte blocks of memory down in the heap would waste too much CPU time.

 

Note that all of these mechanisms are transparent to your application code. To you, the developer, it looks like there is just one managed heap; these mechanisms exist simply to improve application performance.

 

For more on .NET memory management, check out this (very good) article: http://msdn.microsoft.com/msdnmag/issues/1200/GCI2/