I have an ASP.NET website that seems to be using a lot of memory. I left it for 7 hours on Sunday and it reached 3.2gb. I thought .NET handled all it's own garbage collection / free'd objects and so on, so I am not really sure where to start looking for a solution.
The website uses XML's heavily so I thought this could be the issue but I have implemented the global use of the XMLSerializer to try and rule this out.
I also have a custom handler that deals with all the images, resizes, caches and then loads from cache where it can. Could this be causing any issues?
Sorry to be so vague but the problem is that I don't know where to start with the issue really. Any help appreciated.
Server info: .NET 2.0 Windows 2008 server IIS7
Thanks in advance.
Best place to start is using a profiler. RedGate has the ANTS Memory Profiler which is really good and has a free trial. Product page here.
You run the application, attach the profiler then start using the page as normal. The profiler collects information about the objects in use and this should allow you to pinpoint the root cause of the problem.
Once in my application, it turned out to be that we were accidentally creating a NHibernate SessionFactory for every single query that we performed. These were all referenced internally by NHibernate, which meant that they were never freed in addition to being horribly slow and inefficient. The profiler lead us right to it and we never would have found it otherwise.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With