tags:

views:

52

answers:

1

Is there a way to know if two addresses, which are references to two objects are connected ? By connected I mean whether one of the objects holds a reference to the other object.

A: 

In most languages, the memory storing the object referencing the other will contain a pointer to the other object. The difficulty is then to determine where this memory starts and end.

If you are in .Net, there is a windbg extension named sosex that exposes a !refs command displaying the immediate references from and to a given object.

If you are in native code, you can use !heap -p -a to obtain the logical memory block containing an object and then check if this memory contains a pointer to the memory of the other object.

plodoc