How to detect if the large object heap is causing the out of memory exception

1.3k views Asked by At

I'm having System.OutOfMemory exceptions in my .NET Windows Service. I'm not sure what's causing it. I suspect fragmentation in the large object heap but i'm not sure. How can I verify my hypothesis?

I can use debuggers of all kinds, but what in the debugger should I look for?

Thanks

2

There are 2 answers

0
Mikael Östberg On

I guess this happens randomly and never when you are debugging on your machine, right?

What you can do is to create a dump and analyse the remains.

You need to turn to the true master of debugging, Tess. She is the Chuck Norris of debugging.

Check this out, for example.

7
Jesse C. Slicer On

CLR Profiler is your friend for this. It can attach to a Windows Service and gather all the metrics you need to find what's the culprit when your OOM hits.