Question

I have a windows service that performs bulk inserts triggered by a time. I am using sharp (contrib) architecture and NHibernate. The service's memory consumption seems to go up slowly/linearly over time. I would like to investigate what causes this. Could anyone please be so kind and recommend a tool? Thanks.

Was it helpful?

Solution

There are commercial profilers (ANTS Profiler, DotTrace, etc) but also the excellent SOS debugger extension, which you can use from Visual Studio or WinDbg. There are many articles about how to use SOS. Tess Ferrandez' blog is an excellent resource on debugging.

Typically, you will use SOS similar to this. First run:

!EEHeap

to check the status of the heap, followed by

!dumpheap -stat

to see what is the type of the leaked objects. From there, you can use

!dumpheap -type <object type>

to list the objects and then

!gcroot <object address>

for a specific object, to see which roots are keeping the object alive.

However, I always start with checking the GC performance counters in such cases, to understand the leak pattern, see which heap is growing etc.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top