How to Identify where Instances of an object are Still Referenced?

前端 未结 3 1602
情书的邮戳
情书的邮戳 2020-12-14 04:04

After running the VS2010 profiler with Object Lifetime Tracking in my app, I have this on a particular class :

Number of Instances----------

3条回答
  •  一整个雨季
    2020-12-14 04:55

    EDIT 2018: if you have visual studio 2015+ then the whole process is much simpler: MSDN tutorial.

    if you want to know exactly which instances are alive , all you need to do is take a process dump with Adplus, that comes with the debugging tools for windows. (its now part of the SDK download.)

    then in WinDBG, use the !dumpheap -type command to see what instaces of which classes are still up.

    then you can use the !gcroot to see who is holding that reference.

提交回复
热议问题