FullGC normaly pauses all Threads while running. Having two AppDomains, each running several threads. When GC runs, will all threads be paused, or only those of either one AppDomain?
相关问题
- Generic Generics in Managed C++
- How to Debug/Register a Permanent WMI Event Which
- C# GC not freeing memory [duplicate]
- 'System.Threading.ThreadAbortException' in
- Bulk update SQL Server C#
Hard to answer, best thing to do is just test it:
Output:
Good evidence that a GC affects all AppDomains on the default CLR host. This surprised me.
From this thread here: Is the garbage collector in .net system-wide or application-wide?, it occurs on the process level. All threads in that process will be paused but not across multiple processes.
One or multiple app domains can exist within a process but app domains are not shared between processes. Per: http://blogs.msdn.com/b/tess/archive/2008/08/19/questions-on-application-domains-application-pools-and-unhandled-exceptions.aspx, "all appdomains in the process share the same GC." Accordingly, GC should affect all app domains when a GC is triggered.
However, a CPU performance hit can occur with too many processes spending time doing GC which can negatively affect the performance of other processes not involved in a GC.
This link also explains the fundamentals of GC too:
http://msdn.microsoft.com/en-us/library/ee787088.aspx