May 5, 2010
Blog Archives.NET Memory Leak: XslCompiledTransform and “leaked” dynamic assemblies
I have written before about high memory usage caused by improper usage of XmlSerializer objects both in a case study and in a debugging lab . The problem there was that every time you create a new XmlSerializer object with a non-default constructor, you generate a new dynamic assembly that contains the definition and methods for the serializer. Since assemblies can’t be unloaded from a process unless the application domain they are loaded in is unloaded memory will keep increasing if you create new XmlSerializer objects until eventually you end up with a System.OutOfMemoryException. In the case of the XmlSerializer dynamic assemblies, they are quite easy to spot as you can look at meta-data (see previous posts) and figure out that…(read more)
IIS and PAE
I recently got a question by one of my customers about PAE and IIS that I thought I’d share the answer to. Their environment looked something like this: 32bit OS (Windows 2003) IIS 6 with multiple application pools, where each app pool hosts a number of applications ~20 GB RAM They were having problems with out of memory exceptions and also with paging under high load. They knew a lot about their application and memory usage in general, so they knew what they were using the memory for and why they got the OOMs , in this case, memory usage was relatively high per application (intentionally), but it remained stable so no leak. With this in mind, we discussed solutions to the OOMs like splitting up the applications further etc. to avoid…(read more)
Tool for generating DGML graphs showing why your object can’t be collected (VisualGCRoot)
Visual Studio.NET 2010 has a new feature that allows you to create nice directed graphs with a markup language called DGML (Directed Graph Markup Language). Visualizing object graphs with DGML Chris Lovett wrote a tool that takes GCRoot output and transforms it to a DGML document so that you can see the roots of an object in a more visual way, and finally Mohamed Mahmoud went one step further and made a debugger extension that does this for you directly. The debugger extension is called VGCRoot and you can get the extension, and some instructions and demos for it here . The VGCRoot extensions If you are looking at a memory dump in windbg and try to figure out why your object is still sticking around, collection after…(read more)
Debugging Native memory leaks with Debug Diag 1.1
I often get questions about debugging native memory leaks. In other words, cases where you have high memory usage in your application but you can see that .net memory usage is not all that high. Recently I was helping out on such a case and this post details both generally how you go about troubleshooting these issues as well as what troubleshooting steps we went through in this particular case. Essentially you would go through these steps to troubleshoot a native memory leak: 1. Find out if your memory usage / leak is mostly .net memory or native memory 2. If it is native memory that is “leaking”, use a tool like debug diag 1.1. to track allocations and deallocations 3. Look at the main allocators and the stacks associated with the biggest…(read more)