Tracking down and fixing a memory leak with dotMemory
In this section, we are going to run through an example of how to track down and fix memory leaks. A memory leak occurs when objects become inaccessible and remain in memory without being garbage collected. As the number of objects builds up, memory runs out and you end up with an OutOfMemoryException
exception being thrown by the application.
Our example will be a WPF application called CH05_GameOfLife
. To save time and space, download the source code for the WPF application. This will help you to focus on the task at hand, which is to track down the memory leak and fix it.
Note
When profiling and tracing, you are better off building your projects using Release mode. The reason for this is that Debug builds contain compiler instructions that might affect profiling results.
Perform the following steps:
- Download and compile the
CH05_GameOfLife
project in Release mode. - Open dotMemory. The version used in this...