I am running a large ASP.net 4.0 website. It uses the popular .Net content management system, has thousands of content elements, hundreds of concurrent users - this is basically a heavy website.
Within 1 day, IIS7 workflow memory usage can increase to 8-10 GB. The server has 16 GB installed and is currently configured to reuse the application pool once a day.
I get pressure to reduce memory usage. Most of the memory usage is associated with caching large lines of data, but the cache interval is set to only 5-10 minutes, so these lines should eventually expire from memory.
However, after starting RedGate Memory Profiler, I see what, in my opinion, is a memory leak. I filtered the results of my list of instances with objects that are "stored in memory exclusively by remote objects" (I read on the RedGate forum that this way you detect memory leaks). This gave me a long list of lines that are stored in memory.
For each row, I use the Instance Retention Graph to see what holds it in memory. It seems that System.string objects were cached at some point by System.Web.Caching.CacheDependency. If I follow the graph in its entirety, it goes through various other classes, including System.Collections.Specialized.ListDictionary, until it reaches System.Web.FileMonitor. This makes sense since the lines are the paths to the file (images / PDFs / etc).
It seems that the CMS caches file paths, but these cached objects then "leak out". Over time, this increases and consumes RAM.
Sorry, this is a long wind ... Is there a way to stop these memory leaks? Or clean them without resorting to recycling the application pool? Can I find which class / code caches to see if I can fix the leak?
source share