开发者

Deciphering variable information while debugging Java

I'm using IntelliJ IDEA 8 for debugging some Java, but this question could probably apply to all Java debuggers. In the list of va开发者_开发问答riables, they are displayed as:

myVariable = {some.package.SomeClass@12345}

I am curious about the number that comes after the class name. What is the number exactly? Would two variables have the same number if it is the same underlying object that is being referred to?

Thanks in advance.


That is objectId reported by the JVM, for details please see the JDWP specification.

Uniquely identifies an object in the target VM. A particular object will be identified by exactly one objectID in JDWP commands and replies throughout its lifetime (or until the objectID is explicitly disposed). An ObjectID is not reused to identify a different object unless it has been explicitly disposed, regardless of whether the referenced object has been garbage collected. An objectID of 0 represents a null object. Note that the existence of an object ID does not prevent the garbage collection of the object. Any attempt to access a a garbage collected object with its object ID will result in the INVALID_OBJECT error code. Garbage collection can be disabled with the DisableCollection command, but it is not usually necessary to do so.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜