3

I am developing a WinForm application. When running it for a long time wihout stopping, it suddenly raise a OutOfMemoryException. I don't know how to find the reason which causes this exception. I use Task Manager to see how much memory my application to use, I see that it only take 90000 KB while my RAM is 2GB. I don't know it is a memory leak error? If yes, I remember there are some .NET tools to help finding the memory leak.

Please help me. Thanks.

1

2 Answers 2

4

If you run your application through WinDbg you will be able to get a break down of all the objects in memory. A unusually large number will pin point the exact object that is causing this behavior.

You can follow these instructions

In a nut shell you do

  1. Attach WinDbg to process
  2. Issue .load SOS.dll command
  3. Issue !dumpheap –stat to view managed objects
Sign up to request clarification or add additional context in comments.

1 Comment

WinDbg is not easy to use but it's very powerful tool. +1.
1

vmmap

A useful tool to see how much and what kind memory your process is using.

CLR Profiler

Provides a graphical view of the heap and what is holding on to what. It can be a bit slow, but if the leak is in the managed heap it will point out what types are the problem pretty easily. Here's a guide.

WinDBG

Like parapura mentioned, this is will let you find your leak, but there's a steep learning curve (and almost no gui).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.