Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is object graph in java?

Tags:

java

Whenever I study Garbage Collector I hear the term object Graph. What does it mean exactly?

like image 379
giri Avatar asked Jan 12 '10 04:01

giri


People also ask

What is the graph of an object?

An object graph is a view of an object system at a particular point in time. Whereas a normal data model such as a UML class diagram details the relationships between classes, the object graph relates their instances. Object diagrams are subsets of the overall object graph.

How do you create an object graph in Java?

An object graph contains a set of objects that are automatically serialized given that the object that contains the reference is serialized too. Any object that is serialized and contains an object reference, the object reference will be serialized by the JVM.

What is object () in Java?

A Java object is a member (also called an instance) of a Java class. Each object has an identity, a behavior and a state. The state of an object is stored in fields (variables), while methods (functions) display the object's behavior. Objects are created at runtime from templates, which are also known as classes.

What is a graph in Java?

Q #1) What is a Graph in Java? Answer: A graph data structure mainly stores connected data, for example, a network of people or a network of cities. A graph data structure typically consists of nodes or points called vertices. Each vertex is connected to another vertex using links called edges.


1 Answers

Objects have references to other objects which may in turn have references to more objects including the starting object. This creates a graph of objects, useful in reachability analysis. For instance, if the starting object is reachable (say it's in a thread's local stack) then all objects in the graph are reachable and an exact garbage collector cannot harvest any of these objects. Similarly, starting with a set of live objects (roots) if we create a list of all reachable objects, all other objects are garbage - fair game for collection.

like image 74
Chandra Patni Avatar answered Sep 23 '22 19:09

Chandra Patni