JIT vs NGen - what is the difference?

后端 未结 5 2151
青春惊慌失措
青春惊慌失措 2020-12-13 04:35

So when CLR runtime load a .NET assembly, it compiles it into machine native code. This process is called JITing. NGen is also the process of compiling .NET assembly into na

5条回答
  •  没有蜡笔的小新
    2020-12-13 05:34

    One very major important difference that has yet to be mentioned is that the native cached images have 'shared code pages', which makes a huge difference in the memory footprint of applications running over Terminal Services or Citrix.

    The critical thing to understand about NGEN is that whilst it compiles your code, it also marks the code pages as shareable, so that multiple instances of your application can share parts of the memory space used by the first instance. And that’s really useful if you’re running under Terminal Services.

    http://blogs.msdn.com/b/morgan/archive/2009/03/07/developing-net-applications-for-deployment-on-terminal-services-or-citrix.aspx.

    This has very important implications for applications being used by multiple users on a single machine as they share memory across processes. This can lead to very strange, difficult to reproduce behaviour and resource management problems if the image caches are not well maintained.

提交回复
热议问题