Number of CLR and GC instances running on a machine?

前端 未结 4 1741
逝去的感伤
逝去的感伤 2020-12-29 10:59

I create 2 .NET applications and run them on a machine - how many CLR\'s and gc\'s will be there?

In addition: I would like to have some background information on ho

4条回答
  •  半阙折子戏
    2020-12-29 11:32

    A managed exe has an additional CLR header in addition to the Portable Executable (PE format). The OS now is able to determine if the launched exe is a "managed" exe, and hence loads the CLR behind the scenes and gives it control.

    • mscoree.dll is a shim DLL (the latest version of this file is always present in the Windows/System32 folder and hence knows how to load current and older versions of the CLR.)
    • mscorwks.dll is the actual implementation of the CLR. You will find multiple versions of this dll if you have multiple versions of the framework installed. The right version of this dll is loaded by the shim dll.

    It follows from the above that each managed executable's process would have its own copy of the CLR (2 Dlls). ManagedExecutable1 may be using CLR v1 whereas ManagedExecutable2 may be using CLR v2. They are not shared as of now.
    The Garbage collector is part of the CLR and hence is also distinct across processes for managed executables.

提交回复
热议问题