LOH profiling says GC root objects (System.Object) are a source of memory leak

I have HttpHandlerone that is often called. He uses Entity Frameworkto accomplish his task.

There is a slow increase in memory usage with w3p.exethis web application (it has a separate application pool). I used ANTS memory profiler, and there is a lot of free memory (LOH). ANTSsays these are objects GC root. I checked my code, and there are several intand stringthat cannot lead to LOH!

I traced the source of the leak, but unfortunately it is a type System.Objectwith a lot of properties null. Also there LinkedListare some HashTableand a WeakHashTable.

How to find out what this object is and fix it LOH? How about refund truefor IsReusableout HttpHandler?

+3
source share
1 answer

First of all, you should keep track of what is really happening. In such situations, my first tool is always WinDbg.

http://www.windbg.org/ http://en.wikipedia.org/wiki/WinDbg

To use it with managed / .NET code, you need to use the SOS (Son of Strike) extension:

http://msdn.microsoft.com/en-us/library/bb190764.aspx

http://blogs.msdn.com/b/johan/archive/2007/11/13/getting-started-with-windbg-part-i.aspx

, WinDbg w3wp.exe, , , , :

!dumpheap -stat

"" , , , .

(LOH) - , , , . . , - , . , , 85000 , " ". , , , , , , .. ..

, windbg , LOH:

!dumpheap -stat -min 85000

, . , , MyClass [].

: , , (, ), , , . / , .

, - SOS:

http://windbg.info/doc/1-common-cmds.html

http://windbg.info/doc/2-windbg-a-z.html

Fun:

!gcroot <address>   <- will show you what object is "rooting" another
!CLRStack           <- show current managed call stack
!dumpobj <address>  <- show information about object at address

:

bp clr!SVR::gc_heap::allocate_large_object "!CLRStack; g;"

, CLR , , .

+1

All Articles