Whenever I study Garbage Collector I hear the term object Graph. What does it mean exactly?
An 'Object Graph' is the conceptualization of all instances of the objects from your object model (the classes in your program) and their interconnections.
Take for example:
You have two classes
Class Foo
{
String aString = "foo";
Bar aBar;
}
Class Bar
{
String aString = "boo";
}
If you were to create an instance, Foo myFoo and then create an instance of Bar myBar, and connect them, myFoo.aBar = myBar;, your object graph would consist of a single instance of Foo with a reference to a single instance of Bar.
The garbage collector essentially uses the object graph to determine which instances in memory are still linked to something and possibly needed by the program, and which instances are no longer accessible and therefore can be deleted.
Someone on wikipedia puts it more eloquently than me:
Object-oriented applications contain complex webs of interrelated objects. Objects are linked to each other by one object either owning or containing another object or holding a reference to another object. This web of objects is called an object graph and it is the more abstract structure that can be used in discussing an application's state.