Search code examples
windbgdotmemory

Object count is off by a factor of 2


I have a dotMemory profiling session and I was unable to find the memory leak, so I did the following:

  1. Start dotMemory session
  2. Attach WinDbg and break into the process
  3. Take a snapshot in dotMemory
  4. Let the process continue (g) so that dotMemory can take the snapshop
  5. After the snapshot was taken, break into the process again

Like that I should get identical results, if the application is in an idle state, i.e. does nothing (well, it runs the message pump).

Looking at the objects in that snapshot of dotMemory, I can see 88000 objects of type JProperty:

dotMemory Screenshot

In WinDbg however, I see the double amount of objects:

0:021> !dumpheap -stat -type JProperty
Statistics:
              MT    Count    TotalSize Class Name
000007fe7d3a3c28    83930      3357200 Newtonsoft.Json.Linq.JPropertyKeyedCollection
000007fe7d3a4ef0   177104      4250496 Newtonsoft.Json.Linq.JProperty+JPropertyList
000007fe7d3a4b80   177104     18418816 Newtonsoft.Json.Linq.JProperty
Total 438138 objects

Who's wrong - or is it a known issue to use the debugger along with dotMemory?

I'm using dotMemory 2018.1.4 and WinDbg 10.0.15063 on Windows 7, debugging a x64 program, if any of that matters.


Solution

  • It looks like this was a bug in dotMemory 2018.1.4. For some reasons I did not get updates automatically. I have now updated to version 2018.2.1 and the object count is identical.

    I tried to find an issue in their bug tracker, but I didn't find one.