// This is the script to give summary on the main page.
Think IPM

Monday, July 27, 2009

Did you know? MSCORSVW.EXE Tip

Written by Aaron Silber

Missing Puzzle PieceI just got finished installing the SQL 2005 tools and noticed that there was a process called mscorsvw.exe sucking up resources, around 90% of my CPU. My natural instinct would be to kill the process or reboot my machine which would probably deal with the issue, but I decided to give it a moment or two to see if it settled down. Anyway, eventually it did settle down, but it did remain in memory, so I did a little digging and found out the following information and found the following:

When mscorsvw.exe takes up resources, it is precompiling .NET assemblies in the background. Once it's done, it will go away. Typically, after you install the .NET Redist, it will be done with the high priority assemblies in 5 to 10 minutes and then will wait until your computer is idle to process the low priority assemblies. Once it does that it will shutdown and you won't see mscorsvw.exe. One important thing is that while you may see 100% CPU usage, the compilation happens in a process with low priority, so it tries not to steal the CPU for other stuff you are doing. Once everything is compiled, assemblies will now be able to share pages across different processes and warm start up will be typically much faster, so we're not throwing away your cycles.

This got me thinking that if it is still doing stuff in the background after I “finished” my install, then maybe my install really isn’t finished at all. I dug a little further and found that there is a way to force all of the remaining items to be compiled (or is that pre-compiled?) with a command called NGEN.exe. You can find this command in the C:\Windows\Microsoft.NET\Framework\v2.0.50727 (probably based on .NET version) folder. Go to this folder and from a command prompt issue the following command:

NGEN executequeueditems

then stand back and watch it go! In my case it ran for around seven minutes before it was done. I can now feel comfortable that my install is truly finished!

You can also use this command at anytime to see if there is anything queued up waiting to be executed:

NGEN queue status

Aaron

blog comments powered by Disqus Blog Widget by LinkWithin