Junior — Senior
The impact of cyclic references on garbage collector performance
livecode
Task condition
Let's explore whether the garbage collector can free objects of type X and Y when they reference each other in a cycle.
public class Main {
public static void main(String[] args) {
X objX = new X();
Y objY = new Y();
objX.y = objY;
objY.x = objX;
// Will the objects X and Y be freed?
System.gc();
}
}