How do I find the number of references that exist for a particular object?

I have a bit of code that passes around a ton of objects and I want to determine if there are any references still lingering around that I am unaware of and where it is those references are located. Any idea of how I can do this?

My understanding is that the watch window only allows me to see items available to the currently executing code block, and the "Find All References" only helps if I add references to objects at compile time. Unless there is more to the watch window than I am aware of.


A profiler will allow you to do this. CLR Profiler or ANTS Profiler are two examples.

if you are talking in the code, just right click on the object name, in the drop down menu pick "Find all references", the list of references will appear below in the output window

EDIT: Since there was only a .NET tag, Visual Studio assumed

In a IDE like Elcipse or Visual Studio you can do it with the context menu.

Need Your Help

Composited container from std::set is faster than std::set itself?

performance c++11 stl iterator stdset

I have made some composited container Range which accepts either a min/max range as a std::pair or a set of integers as a std::set.

Dealing with env specific files using WIX

wix wix3.5 wix-extension

I am in the process of migrating all my projects one by one from Installshield to Wix and I would like to find out the best way to deal with env specific files.