Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4483183

BugId4293527T2 - Memory fault error on suse linux

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.4.0
    • hotspot
    • None
    • x86
    • linux_2.2

      Install Merlin build 72 on suse linux 6.4:
      When I compile and run following testcase , returns memory fault.
      *****************************TESTCASE*******************************

       public class BugId4293527T2 implements Runnable {
          private static int stackSize =0;
          private static int recursiveDepth =Integer.MAX_VALUE;
        
          private static int noOfThreads = 1;
          
          private static ThreadGroup group = new ThreadGroup("");
          
          Thread [] thread = new Thread[noOfThreads];
          private boolean stackError = false;
          private boolean memoryError = false;
         
         
          public static void main(String[] args) throws Exception {
              BugId4293527T2 bugId4293527 = new BugId4293527T2();
              
              boolean status[];
              int passcount = 0, failcount = 0;
              int numTests = 1;
              int i, j = 0;
          
              status = new boolean[numTests];
              System.out.println("Total tests for Exec : "+numTests);

              for(i = 0; i < numTests; ++i) {
                      // Put all tests in try... catch block
                  try {
                          ++j;
                          switch (j) {
                                  case 1:
                                      status[i] = bugId4293527.BugId4293527T23Test01()
      ;;
                                  break;
                              }
                  
                      } catch (Exception e) {
                      status[i] = false;
                              System.out.println ("Exception in test "+j+": "+e.getMes
      sage());
                              e.printStackTrace();
                  }
              } // end for

              // Get pass and fail totals
              for(i = 0; i < numTests; ++i) {
                  if (status[i] == true)
                         passcount++;
                      else
                         failcount++;
              }
          
              System.out.println("Pass count: " + passcount);
              System.out.println("Fail count: " + failcount);

              // check if tests passed
              if ( failcount < 1 ) {
                 System.out.println("Test for BugId4293527T2.java Passed");
                 TestHelper.exit(0);
              } else {
                 System.out.println("Test for BugId4293527T2.java Failed");
                 TestHelper.exit(1);
              }
              
           } // end main
         
          
           public boolean BugId4293527T23Test01() {
                 boolean bReturn = false;
                       
                 for (int i =0; i <noOfThreads; i++) {
                     String name = "threadTest" + i;
                     thread[i] = new Thread(group, this,name,stackSize);
                     thread[i].start();
                        
                 }
                   
                 for (int j =0; j <noOfThreads; j++) {
                     while(thread[j].isAlive()){;}
                    // System.out.println("Thread.activeCount = " + Thread.activeCount
      ());
                 }
                    
                System.out.println("Threads activeCount = " + Thread.activeCount());
                
                if (stackError) {
                  bReturn = true;
                  System.out.println("StackOverflowError occured");
                  System.out.println("BugId4293527T23Test01() Pass");
                  return bReturn;
                }
                bReturn = false;
                System.out.println("BugId4293527T23Test01() Fail");
                return bReturn;
           }
       
           public void run() {
              if (recursive(1)==1) {
                  return;
              }
              
         
          }
         int recursive(int i) {
              i = i +1;
             try {
                 if (i <recursiveDepth) {
                    recursive(i);
                 }
                  //stackError = false;
             } catch(StackOverflowError sofle) {
                 //System.out.println("Thread.activeCount = " + Thread.activeCount() +
       " recursiveDepth = " +recursiveDepth + " i = " + i + " stackSize = " + stackS
      ize + " " + sofle);
                 stackError = true;
                 return 1;
             } catch(OutOfMemoryError oome) {
                 memoryError = true;
                 return 1;
             }
            
             return 0;
          }
       }
      ******************************************************************
      when I run the above program.
      #java BugId4293527T2
      #Total Test of Exec:1
      #memory fault

            hhuangsunw Hui Huang (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: