Retrieving a List of Objects Related to an Object

Given a Java object, how can I get a list of objects that reference it?

There must be expansion mechanisms in the GC to do this kind of thing, they just can't find them.

+3
source share
5 answers

I'm not sure exactly what you need is just available.

JPDA (Java platform debugging architecture) allows you to create debuggers, so it is a good starting point if you want to delve into the internal components. There is a blog at JPDA , which may also be useful. Browse the Sun Developer Network JPDA page for links to documentation, FAQs, sample code, and forums.

Two interfaces that can be good starting points:

  • com.sun.jdi.ObjectReference: java.lang.Class instance from the target virtual machine
  • com.sun.jdi.VirtualMachine: virtual machine for debugging
+2
source

, Eclipse MAT, . "GC-", .. , .

+2

, , , GC .

0

, , , , heapdump MemoryAnalyzer JHat, , . : .

0

GC does not support this, although the JDPA APIs. But I would be very careful about such things in a Java application. This is likely to be prohibitively expensive both in time and in memory.

0
source

Source: https://habr.com/ru/post/1712904/


All Articles