Saturday, 23 November 2019

SE - 41 - Island of isolation in JAVA

Island of isolation is a term given to a condition where 2 objects are ready for garbage collection when the following conditions are met :

1) Object 1 references to Object 2
2) Object 2 references to Object 1

      Test i;
      public static void main(String[] args) 
      {
          Test t1 = new Test();
          Test t2 = new Test();
          t1.i = t2;
          t2.i = t1;
          t1 = null;
          t2 = null;
          System.gc();
      }

No comments:

Post a Comment