Home All Groups Group Topic Archive Search About

.net runtime optimization service

Author
20 Jan 2006 10:18 PM
Erik B.
Question about the .net optimization service:

I have been having an issue where my system has been running out of disk
space constantly, after going through the usual spyware/virus scans etc.  I
noticed in my error logs that the .net runtime optimization service was
logging numerous information entries.  After some investigation I found that
my assembly directory was 5gb.  Under the Native Images directory for 2.0,
and under each directory for each assebly there were multiple copies of each
native image for each assembly.  After stopping the .net runtime optimization
service these duplicates stopped.  What I'm trying to figure out is why this
happened so that I can correct the problem.  Any help would be appreciated.

Thanks,
Erik Beltran
Solutions, LLC

Author
21 Jan 2006 5:03 PM
Richard Grimes
Erik B. wrote:
> Question about the .net optimization service:
>
> I have been having an issue where my system has been running out of
> disk space constantly, after going through the usual spyware/virus
> scans etc.  I noticed in my error logs that the .net runtime
> optimization service was logging numerous information entries.  After
> some investigation I found that my assembly directory was 5gb.  Under
> the Native Images directory for 2.0, and under each directory for
> each assebly there were multiple copies of each native image for each
> assembly.  After stopping the .net runtime optimization service these
> duplicates stopped.  What I'm trying to figure out is why this
> happened so that I can correct the problem.  Any help would be
> appreciated.

I don't have any solutions, just some questions. Yiou say that you have
multiple copies, can you explain how. The optimization service names the
native image using the tag ni (eg the native image for lib.dll is
lib.ni.dll) Thus in one folder you can have just one copy. Each version
has a separate folder, are you seeing multiple copies corresponding to
multiple versions of an assembly? Do you have multiple users on your
machine? When I check the security descriptor of (for example)
mscorlib.ni.dll on my machine I find that the owner is my account
(although the command line tool cacls does not give you the owner, it
will list the owner in the list of account rights that it will display).

Richard
Author
21 Jan 2006 11:14 PM
Erik B.
For Example:

In c:\windows\assembly\NavtiveImages2_v2.0.50727_32 there is a directory for
each assembly my machine looks something like this:

c:\
    windows
        assembly
            NativeImages@_v2.0.x
                System
                    at this level there are multiple directories and each
one has a copy of system.ni.dll 

hope this helps, again I stopped it from creating more directories by
shutting down the optimization service, but I would like to know what is
causing it to happen.

Thanks.

Show quote
"Richard Grimes" wrote:

> Erik B. wrote:
> > Question about the .net optimization service:
> >
> > I have been having an issue where my system has been running out of
> > disk space constantly, after going through the usual spyware/virus
> > scans etc.  I noticed in my error logs that the .net runtime
> > optimization service was logging numerous information entries.  After
> > some investigation I found that my assembly directory was 5gb.  Under
> > the Native Images directory for 2.0, and under each directory for
> > each assebly there were multiple copies of each native image for each
> > assembly.  After stopping the .net runtime optimization service these
> > duplicates stopped.  What I'm trying to figure out is why this
> > happened so that I can correct the problem.  Any help would be
> > appreciated.
>
> I don't have any solutions, just some questions. Yiou say that you have
> multiple copies, can you explain how. The optimization service names the
> native image using the tag ni (eg the native image for lib.dll is
> lib.ni.dll) Thus in one folder you can have just one copy. Each version
> has a separate folder, are you seeing multiple copies corresponding to
> multiple versions of an assembly? Do you have multiple users on your
> machine? When I check the security descriptor of (for example)
> mscorlib.ni.dll on my machine I find that the owner is my account
> (although the command line tool cacls does not give you the owner, it
> will list the owner in the list of account rights that it will display).
>
> Richard
> --
> Fusion Tutorial: http://www.grimes.demon.co.uk/workshops/fusionWS.htm
> Security Tutorial:
> http://www.grimes.demon.co.uk/workshops/securityWS.htm
>
>
>
Author
23 Jan 2006 2:08 PM
Richard Grimes
Erik B. wrote:
> hope this helps, again I stopped it from creating more directories by
> shutting down the optimization service, but I would like to know what
> is causing it to happen.

I haven't been able to decipher what the directory names below the
directory with the name of the assembly, it may just be derived from the
time and date, or maybe it is a hash of the native image.

One thing you should be aware of is that .NET link demands are performed
at JIT time which means that if your security policy changes then .NET
will have to ngen all the native images again to take into account the
new security settings. Have you changed the CAS security on your machine
recently?

If it was my machine, I would be tempted to write a small program that
uses a type in one of the assemblies with a native image and in the
program I would print out

Assembly.GetExecutingAssembly().Codebase

(or maybe even assume that the last folder created has the native image
that would be used)

Then I would rename the other folders (add .old to the end of the
existing name) and after testing, if I was convinced those native images
weren't used, I would delete them.

Of course, you would only do this too at your own risk!

Richard

AddThis Social Bookmark Button