The Artima Developer Community
Sponsored Link

.NET Buzz Forum
The managed memory heap and its components

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Raymond Lewallen

Posts: 312
Nickname: rlewallen
Registered: Apr, 2005

Raymond Lewallen is a .Net developer and Sql Server DBA
The managed memory heap and its components Posted: Jul 10, 2005 7:24 PM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by Raymond Lewallen.
Original Post: The managed memory heap and its components
Feed Title: Raymond Lewallen
Feed URL: /error.htm?aspxerrorpath=/blogs/raymond.lewallen/rss.aspx
Feed Description: Patterns and Practices, OOP, .Net and Sql
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Raymond Lewallen
Latest Posts From Raymond Lewallen

Advertisement

There are the Gen 0, Gen 1, and Gen 2 heaps and the large object heap. The GC acts on the "managed" or "GC" heap by collecting unreferenced objects, promoting objects to later generations, and altering the heap after a collection so memory is contiguous. In the implementation of .NET Version 1.0, the initial thresholds for generations 0, 1, and 2 are 256 kilobytes (KB), 2 megabytes (MB), and 10 MB, respectively. Note that the GC can adjust these thresholds dynamically based on an application's patterns of allocation.

Objects larger than 85 KB are automatically placed in the large object heap. These objects are finalized and freed just like objects on the regular heap. However, the heap is never compacted because shifting these large blocks of memory would waste a lot of CPU time. Also, the large object heap is only collected on full GC collections. Note that some MSDN pages say the large object heap holds objects greater than 20 KB; that is outdated information.

Loader Heaps are used for loading runtime CLR structures. The loader heaps hold together the type system, as opposed to the managed heap which hosts objects. Frequently accessed items like statics, MethodTables, FieldDescs, and Interface Maps are allocated on the High Frequency Heap. Less frequently accessed data structures, like EEClass, ClassLoader, and its look up tables are allocated on a Low Frequency Heap. Finally, the StubHeap hosts stubs that facilitate CAS, COM wrapper calls, and P/Invoke. The HighFrequencyHeap initial reserve size is 32KB and its commit size is 4KB. LowFrequencyHeap and StubHeaps are initially reserved with 8KB and committed at 4KB.

A great article that discusses heaps, along with ways to view your heap sizes, is "Production Debugging for .NET Framework Applications":http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/dbgch02.asp

Another article that discusses the heaps is "Drill Into .NET Framework Internals to See How the CLR Creates Runtime Objects": http://msdn.microsoft.commsdnmag/issues/05/05/JITCompiler/default.aspx. This article provides a little more information on the Loader Heaps.

Thanks to Craig at Microsoft for helping me clarify some of this information.

Read: The managed memory heap and its components

Topic: Predictably SOA Previous Topic   Next Topic Topic: VB as a dynamic language

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use