Tuesday, March 1, 2011

Finding references to an object

Is there any way to find all references to an object while debugging?

From stackoverflow
  • Not without using the profiling/debugger API, as far as I'm aware. (Even with the API, I don't know how to do it.)

  • Not with the default tools that Visual Studio offers you. There are 3rd party "Memory Profilers" out there that will allow you to do this. I have used one myself to hunt down a "memory leak" in a .NET program.

  • If you're willing to dig into WinDbg it is fairly easy to find references to a specific object. However, WinDbg is not the easiest tool to use.

    This blog has lots of info on using WinDbg.

    Sorskoot : I'm go to dive into this tool. Thanks.
    Brian Rasmussen : You're welcome - I use WinDbg on a regular basis for managed code. Check out sosex.dll as well (more commands for managed debugging with WinDbg).

0 comments:

Post a Comment