Is there any way to find all references to an object while debugging?
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.
A reference to an existing object in Java can be created simply by equating a variable to the object.
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.
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.)
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With