Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finding references to an object

Tags:

c#

debugging

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

like image 990
Sorskoot Avatar asked Dec 19 '08 09:12

Sorskoot


People also ask

What is a references to an object?

A reference also contains information to assist in creating an instance of the object to which the reference refers. It contains the Java class name of that object, as well as the class name and location of the object factory to be used to create the object.

How do you reference an object in Java?

A reference to an existing object in Java can be created simply by equating a variable to the object.

Do object references point to objects?

Object references are passed by value The reason is that Java object variables are simply references that point to real objects in the memory heap. Therefore, even though Java passes parameters to methods by value, if the variable points to an object reference, the real object will also be changed.


2 Answers

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.)

like image 164
Jon Skeet Avatar answered Oct 17 '22 12:10

Jon Skeet


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.

like image 24
Brian Rasmussen Avatar answered Oct 17 '22 11:10

Brian Rasmussen