views:

881

answers:

4

I have many instances of an application installed on an IIS 6.0, Windows Server 2003 box under the same application pool. They share many of the same assemblies and can not be joined in to a single application.

I recently added a new instance of the application and obtained a System.OutOfMemoryException when I tried to load the ASP.NET 2.0 application.

Will using the GAC to store common assemblies fix this error or can this only be remedied by spacing the sites between different application pools?

+1  A: 

Putting something in the GAC only changes the physical location of the DLL (and security settings), it doesn't change what's loaded into memory.

Most people tend to think of the GAC as "where Microsoft puts their stuff". I haven't seen many applications created by "everybody else" that can justify using the GAC.

You should probably start thinking about a load-balancing solution of you are putting that much RAM pressure on your machine.

Eric Z Beard
The ram isn't maxed out at all. It looks like it's only the application pool that is becoming stressed. Regretfully, I haven't noticed an area to see what the current RAM usage and limit of an application pool is.
+1  A: 

Make sure you have deployment retail = "true" set in the Machine.Config:

<system.web>
    <!--
        <deployment
            retail = "false" [true|false]
        />
    --> 
   <deployment retail="true" />
</system.web>

Debug code takes a lot more memory then non-debug, and compiling into single assemblies rather than one per page will reduce the memory overhead of assembly loads.

Make sure you're memory settings on your application pools are set high enough, and you also might want to take a look at the ProcessModel MemoryLimit setting: http://msdn.microsoft.com/en-us/library/7w2sway1(VS.71).aspx

And try using an 80% or 85% setting:

<processModel 
  memoryLimit="80"
/>
Christopher_G_Lewis
Can anyone comment on whether processModel memoryLimit applies to *all* .Net processes, or just ASP.Net?
tbone
"processModel" is for ASP.Net only, I believe: http://msdn.microsoft.com/en-us/library/7w2sway1(VS.71).aspx
Christopher_G_Lewis
A: 

Putting a shared assembly into the GAC saves drive space, eg. if you have 20 asp applications that use the same dll. It might be the case that you load fewer copies of teh same dll into memory as well, I'm not sure. That said, OutOfMemoryErrors are more likely to be caused by loading extremely large obejects into memory, a typical example is a DataSet. Assemblies are small in comparison to the memory you can eat up with large datasets or large xml files in memory.

MatthewMartin
A: 

What type of request did this occur on? You might want to read about this common cause of OutOfMemoryExceptions.