4 Replies Latest reply: Nov 17, 2009 1:18 PM by 843829 RSS

    JVM 1.6.16 crash on loops

    843829
      While testing JVM 1.6.16 before using it for our application i've found a strange bug.

      The VM ALWAYS crash when i execute this quite simple sample of code.

      Do anyone reproduce the problem or has any clue of it's reason ?
      package crashVM;
      
      public class CrashTest {
      
       /**
        * @param args
        */
       public static void main(String[] args) {
         for (int i = 0; i < 2; i++)
           NestedLoop();
       }
      
       public static long NestedLoop() {
         final int n = 50;
      
         long startTime = System.currentTimeMillis();
      
         int x = 0;
         for (int a = 0; a < n; a++)
           for (int b = 0; b < n; b++)
             for (int c = 0; c < n; c++)
               for (int d = 0; d < n; d++)
                 for (int e = 0; e < n; e++)
                   for (int f = 0; f < n; f++)
                     x++;
      
         long stopTime = System.currentTimeMillis();
      
         return stopTime - startTime;
       }
      
      }
      Thanx !