I have an ASP.NET website that will hit about 2gb physical memory used within about 3-4 days, which to me sounds really bad. At the moment, I have configured IIS to restart
There are a few things you should look at :
First of all, are you using sessions? Are they in proc or SQL sessions? If they are in process, what's the timeout set at? If you have a really really long timeout, this could explain why you are using so much memory (the user sessions would be stored for a long time).
Second, disposing of objects. The .NET garbage collector will get rid of references for you, but when you are creating objects that implement the IDisposable interface, you should always use the using keyword.
using(Foo foo = new Foo())
{
...
}
is the equivalent of doing :
Foo foo;
try
{
foo = new Foo();
...
}
finally
{
foo.Dispose();
}
And it will ensure that you dispose of your objects efficiently.
If you still can't find anything obvious in your code, you can profile it, starting with the methods that are called the most. You can find information about good profilers here. That will definitely lead you to the source of your problem.