[SOLVED] Memory problems in ASP.NET

Issue

I got problems with memory in my asp.net application. The problem is that I can’t see any problems when running it locally (between 100-200mb) but on the production system I get 503-errors because of the memory limit (512mb) being reached (running it on shared hosting).

How can I pin down the problem? I don’t think that I have access to the current memory usage, at least I have not found any way and the company who hosts my site says that there is no way.

I have absolutely no experience tracking down memory leaks. 🙂

Thanks

Solution

Use a trial version of RedGate’s Memory Profiler

http://www.red-gate.com/products/ants_memory_profiler/index.htm?utm_source=google&utm_medium=cpc&utm_content=unmet_need&utm_campaign=antsmemoryprofiler&gclid=CJLijJblm6UCFQqAgwodHjokHg

or JetBrains dotTrace

http://www.jetbrains.com/profiler/

Both tools are very simple and easy to use and do a great job of identifying protential memory leaks etc.

Most common sources of leaks are missed dispose calls, or poor management of event handlers… depending on the size of your code base, you may be able to just “spot” the trouble spots, but I find using a tool speeds up the process greatly as both will present before/after snapshots of the object graphs so you can see what is and is not being cleaned up by th GC.

Good overview of memory management:
http://msdn.microsoft.com/en-us/library/ee817660.aspx

Answered By – Chris Baxter

Answer Checked By – Clifford M. (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *