w3wp.exe (ASP .Net) eating memory

  • Thread starter Thread starter venom00
  • Start date Start date
V

venom00

Hello, i'm on a VPS with Windows 2003 x64 (IIS 6.0 so) and i have a
serious problem with w3wp.exe. It starts from 60 Mb and then grows
until the whole avaiable RAM is used.

http://img32.imageshack.us/img32/4120/w3wpgraph.png

Here's an example image showing w3wp.exe private bytes and Gen 0 Heap
size. They seems related, but if I use ".NET CLR Memory/# Bytes in all
Heaps " it is much lower than private bytes. Can we still say that is
an ASP .Net problem?

Moreover analyzing a crash dump the heap size i obtain is smaller, 200
Mb while the crash dump was 700 mb and private bytes about 600 mb.

http://pastebin.com/m6c448c9d

Here is also a !dumpheap -stat:

http://pastebin.com/m7fd72aa

I've done a "!dumpheap -mt 000006427881aaf8" (the System.String entry)
and I've found that the bigger strings are aspx pages. I've a lot of
them on my website (thousands). Maybe w3wp.exe is caching them? How
can i disable this feature?
!gcroot on one of this strings gives the following output:

http://pastebin.com/m15545adc

Does this mean it's orphaned but not collected by the GC?

Here's a "!dumpheap -stat -type Cach":

http://pastebin.com/m2955d688

And a !do and a !gcroot of a CacheEntry:

http://pastebin.com/f38df0a24


If you need it, I can also give you the link to the whole dump. I've
been working on it for a week without results!

Thanks in advance,
Carl
 
venom00 wrote:

<snipped>

W3wp.exe is the process that hosts ASP.NET applications. It does nothing
on its own. So, some ASP.NET application W3wp.exe is hosting is using all
the memory and not W3wp.exe itself.


You can use Process Explorer to look at a running process such as
w3wp.exe in the upper pane, right-click select Properties to see what
w3wp.exe is hosting at runtime along with other properties that can help
determine who is doing what during the process.

You can set the lower pane off of Tools/View to show all DLL(s) being
hosted by a given process too.

http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx

Well, i know what w3wp is, but my pages aren't doing anything special,
just some DB connections. The problem seems that the ASPX files get
cached for some reason in w3wp.exe and so it grows without limits.
I've tried to limit the cache through the caching element in
web.config, but it doesn't seem to work.
I need to know who and why is using all that memory, if it's not for
caching. Any ideas?
What should you do with DLLs loaded by w3wp?
 
unlike c/c++, .net dll's can not be unloaded except thru a app domain
recycle. every page is compiled into a dll and loaded. high memory use
can be due to:

1) a lot of pages
2) large session / application data
3) failure to release unmanaged memory (database connections)

also if there is memory available, asp.net will grow rather then run the
GC. check your settings.

if you want to know whats going on, get the sos.dll for the windows
debugger.

-- bruce (sqlwork.com)
 
1) a lot of pages

Why a lot of pages shuold be a problem? I've tried to remove any
possible caching through web.config but nothing changed.
2) large session / application data

That's not my case, I almnost don't use sessions.
3) failure to release unmanaged memory (database connections)

Ok, i think that somewhere i leave DB connections open, but they
should be closed when gargabage collected, isn't it?
Anyway how can a couple of connections make RAM usage grow so much?

I think this is a sort of .Net x64 bug:

http://blogs.msdn.com/tess/archive/...memory-usage-in-a-64bit-w3wp-exe-process.aspx
http://support.microsoft.com/?scid=kb;en-us;912891&x=15&y=5

The first article is exactly describing my issue. However the fix is
not public. I think I'll get back to 32 bit.
What do you think? Can this be the problem?
 
Back
Top