What Is the Deal with Memory Difference Mode?

dotTrace 2.0 offers two different ways to profile memory. Each of them is useful for a particular type of profiling tasks, described below.
Dump Memory Mode
You can dump memory at any given time to see what’s in it. This is good for checking whether certain objects are allocated in memory if they are supposed to (or not supposed to), and whether they consume as little memory as they should.
Here’s how you do that:

  1. Start the application for profiling
  2. At any time, click the Dump Memory button on the Control Profiling dialog to generate a snapshot:
    Control Profiling dialog - Dump Memory button

Memory Difference Mode
This lets you check the difference between two application memory states. It’s a good way to profile a certain feature or action in your application. For example, you can have the application open a file and close it, and then see whether all objects associated with the opened file have been properly disposed of. For this, you need to mark the first point in time (“Point A”), let the application do something, then mark the second point (“Point B”). A memory snapshot generated in this way will contain all data related to the memory differences between Point A and Point B.
Here’s how you do that:

  1. Start the application for profiling
  2. At any time, click Mark Memory on the Control Profiling dialog to mark Point A
  3. In the profiled application, perform the action that takes you from Point A to Point B
  4. Click Get Snapshot to mark Point B and generate a snapshot:
    Memory Difference mode - Get Snapshot button
  5. If you want to return to regular profiling mode (no snapshot generation), click Drop Snapshot

In both of these modes, the profiled application continues to run after a snapshot is taken. You are free to combine profiling in the dump memory mode and the memory difference mode as your profiling needs require.

Technorati tags: , ,
Comments below can no longer be edited.

2 Responses to What Is the Deal with Memory Difference Mode?

  1. Avatar

    Luxspes says:

    December 12, 2006

    I would love to see another post on Memory Difference Mode but with a more concrete example (with a little bit of code, and a simple memory optimization)

  2. Avatar

    Len White says:

    May 12, 2012

    I don’t know if I’m doing something wrong or I’m missunderstanding this, but Mark/Get Snapshot doesn’t appear to work the way I expect. If I click on Mark then Get Snapshot and don’t do anything inbetween with my application, I would expect that the snapshot would consist of very little or nothing. Yet it looks like a complete memory dump. If I do it a second time, I get the same result. That is, everytime I do Mark/Get Snapshot, I get the same comprehensive list of objects, even if my application is sitting idle.

Discover more