0

At the beginning of every garbage collection, GC thread needs to figure out what the set of root nodes i.e. those objects that are at the top of reachability hierarchy. Does anyone know how this process is achieved? Is a list maintained and new objects are added/removed on stack frame push/pop? Does JVM scan the stack and figures out what is an object and what isn't (if so - how?)? Also, what about static members, that are available for the duration of the process, do they somehow get added to the list?

Thanks a lot for any info.

Björn Lindqvist
  • 19,221
  • 20
  • 87
  • 122
Bober02
  • 15,034
  • 31
  • 92
  • 178
  • Not really, that one was on how to distinguish between a primitive and object, which was answered to some extent. in this question I am mostly interested in the idea of establishing the set of root nodes and what the technique is – Bober02 Dec 06 '13 at 13:58
  • `static` members are kind of referenced by the `.class` they belong to which is referenced by a `ClassLoader` which are in a way referenced by the application initialization and so they are probably treated in roughly the same way as all the other things. – zapl Dec 06 '13 at 14:04

0 Answers0