Hi,
I have a big confusion with me that if we have a windows application
executable built using C#.NET and when we execute it for the first time the
following things happens:
1. clr calls JIT to convert MSIL to native.
2. native code is cached and when next time same code comes into picture
during execution it gets loaded from the cache instead of getting JITed again.
Now my question is:
1. Is that cached code is there as long as the executable is up and running
or it will be there for always so that when you shuts down your system for
today and then come tommorow and boots up your system fresh and tries to
execute the same executable, then what happens?
Is the cached code is used that was cached yesterday?
or the same process of JITing and caching takes place again

Signature
Thanks
Hitesh
Mattias Sj?gren - 25 Oct 2004 16:59 GMT
>1. Is that cached code is there as long as the executable is up and running
>or it will be there for always so that when you shuts down your system for
>today and then come tommorow and boots up your system fresh and tries to
>execute the same executable, then what happens?
The native code is only stored in memory, and it's lost when the
process terminates. The code will be re-jitted every time you execute
the application.
If you want to store native code on disk you should look into the
Ngen.exe tool.
Mattias

Signature
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Hitesh - 25 Oct 2004 17:21 GMT
Hi Mattias,
Thanks for your answer now i am more comfortable with .NET than earlier.
Thanks and Regards
Hitesh Jain
"Mattias Sjögren" wrote:
> >1. Is that cached code is there as long as the executable is up and running
> >or it will be there for always so that when you shuts down your system for
[quoted text clipped - 9 lines]
>
> Mattias
Richard Blewett [DevelopMentor] - 25 Oct 2004 17:25 GMT
By default, the IL is JIT'd every time the process is run (it is only cached in memory). There is a tool called NGEN.EXE which will compile the code on the deployed machine and cache the image in an area of the GAC called the native cache. However, not all types of applications benefit from being NGEN'd so it is best to test you particular application.
Regards
Richard Blewett - DevelopMentor
http://staff.develop.com/richardb/weblog
Hi,
I have a big confusion with me that if we have a windows application
executable built using C#.NET and when we execute it for the first time the
following things happens:
1. clr calls JIT to convert MSIL to native.
2. native code is cached and when next time same code comes into picture
during execution it gets loaded from the cache instead of getting JITed again.
Now my question is:
1. Is that cached code is there as long as the executable is up and running
or it will be there for always so that when you shuts down your system for
today and then come tommorow and boots up your system fresh and tries to
execute the same executable, then what happens?
Is the cached code is used that was cached yesterday?
or the same process of JITing and caching takes place again
--
Thanks
Hitesh