0

I am trying to understand garbage collection internals and trying to comprehend what root actually refers to? Where does it start to find the roots from? Is it from the current thread execution or picks up objects from the heap and recursively looks at the references?

m_d_p29
  • 163
  • 8
  • `root` is a user level that has access to everything on a device. – Seth McClaine Jun 03 '15 at 02:01
  • 3
    @SethMcClaine: A GC root has nothing to do with that. – SLaks Jun 03 '15 at 02:02
  • If Java reference I used as duplicate does not cover concept of "root in GC" well enough - here is C# one http://stackoverflow.com/questions/8458886/what-is-a-rooted-reference, but it is rather link to existing article, so you've probably already seen it. – Alexei Levenkov Jun 03 '15 at 02:03

1 Answers1

1

The roots are things like global and local variables that are directly accessible by the code.

The GC the finds pointers among those that point into the GC heap, and follows them (recursively) to find other memory that's still accessible.

Jerry Coffin
  • 476,176
  • 80
  • 629
  • 1,111