Collect a memory dump (in some scenarios) is the only way to understand what it is going wrong inside your process. Why? Since you have the possibility to check your application from inside.
As I wrote here, a memory dump is a "picture" of your application for a specific moment of its life. So, it is particularly relevant for me to share with you why it is important to collect a memory dump at right time. To understand it, let me share with you the following example. It is a game that should better explain the topic of this post:
- We have four people and three chairs. As soon as a specific condition occurs, the four people have to sit in one of the available chairs at the same time. As you can understand, it is expected that one person has not the possibility to find his sit.
- The game’s goal is to understand what person is not able to take his chair. The only possibility to active this goal is to take a picture of the room where our people are gaming on.
- How can you active this goal? It is easy, you have to take a picture of our room game as soon as all 3 chairs are occupied by our players. In that moment and exactly in that moment, you will be able to understand what person was not able to find his sit.
Taking a picture in a different moment, will not allow you to achieve your goal. You can do some suppositions, but the only way to be 100% sure about your answer is that: take a picture when all chairs are occupied.
This example should explain the importance to collect a picture, so a memory dump, at right time. Consider for example that you are troubleshooting a first chance exception for your application. Taking a memory dump after two or three minutes that exception occurred is not a good action to understand what is going on. Why? Since the process moved its internal state to a different point, so inside the dump you can see threads not at relevant moment.
You can consider threads as our game players: taking a picture of them in a wrong moment do not allow you to understand where the issue is!
So be sure to collect a dump properly, according to the issue you are trying to figure out.