Roedy Green wrote:
> On 10 Aug 2005 04:47:53 -0700, "Naresh Agarwal"
> <> wrote or quoted :
>
> >Is there a way to get address of a Java object?
>
> toString sometimes gives it to you.
I'm surprised to hear you say that Roedy. If nobody's overloaded
toString() then the implementation in Object will dump the object's
hash code. It does have an @ in the generated string that could
possibly imply an address, but there's nothing that says it's an
address...especially when you consider Robert Kelmme's comment about
the object potentially being moved by the garbage collector.
Some of the debugging stuff that you mentioned probably would make the
addresses available. Another option would be to make some funky JNI
calls that give you the object's address, but then it can always move
unless you lock it down or do some interesting callbacks.
John
http://schemaspy.sourceforge.net