w3wp.exe (ASP .Net) eating memory



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.


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.


Here is also a !dumpheap -stat:


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:


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

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


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


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,




venom00 wrote:


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.


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?

bruce barker

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

-- 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:


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?

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question