Is there
- one Garbage Collector for an entire system
- one instance of a garbage collector for each user that is logged in
- one garbage collector for each running .NET application
Or is it none of the above (please explain)?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There is one GC thread per .NET process and therefore one Heap per process. However, the objects are mapped to the individual AppDomains in order to provide process isolation benefits. While there can be more than one AppDomain within a process, by default there is only one per process.
Terminal Services:
What this means is that for a typical deployment of an application (called MyApp.exe) in a Terminal Services environment, the distinct instances of the .NET application that users are running will each have independent heaps and active memory management. More importantly, the Terminal Services sessions themselves represent a memory boundary of sorts given that sessions are unloaded when the user logs off (http://msdn.microsoft.com/en-us/library/aa383496(VS.85).aspx).
The following illustrates how MyApp.exe would be loaded for each Terminal Services session, and it explains some settings that could impact memory availability and performance within a session: http://blogs.technet.com/askperf/archive/2007/07/24/sessions-desktops-and-windows-stations.aspx
Deep Details:
Please refer to Jon Skeet’s response here for more detail: What is the scope of finalizer thread – per application domain or per process?
Esoteric Details:
Additionally, the following article explains how Microsoft is now allowing side-by-side CLR instances so that multiple versions of the CLR can be run at the same time. This applies to Silverlight specficially: http://msdn.microsoft.com/en-us/magazine/cc721609.aspx
Also, it appears that the this feature is going to be supported for all future versions of the CLR: http://blogs.msdn.com/davbr/archive/2008/11/10/new-stuff-in-profiling-api-for-upcoming-clr-4-0.aspx