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

java program fails allocotaing Object

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • unknown, 1.1.4
    • hotspot
    • generic, sparc
    • solaris_2.5.1, solaris_9


      1) If run as follows:

      java -verbosegc -mx50000 -ms50000 lotsofobjects

      ... it just exits. Uncool, but no biggie.

      2) If run as:

      java -verbosegc -mx100000 -ms100000 lotsofobjects

      It fails. It fails before my main is called.
      Uncool. Don't fix this first!

      Then it fails allocating Object.
      The bug I care about is in allocating Object.
      It shows a heap that is 7% free (6k) but there
      is no room for an 8 byte object. It can't
      be fragmentation (I claim/I hope) since
      my -mx and -ms numbers are the same.

      After it fails, the next allocation works!
      The "stride" between failures is 770.


      europa 262: java -verbosegc -mx100000 -ms100000 lotsofobjects
      <GC: managing allocation failure. need 8200 bytes, type=1, action=1>
      <GC: freed 138 objects, 5448 bytes in 6 ms, 7% free (6616/85192)>
        <GC: init&scan: 1 ms, scan handles: 2 ms, sweep: 0 ms, compact: 3 ms>
      <GC: managing allocation failure. need 8200 bytes, type=1, action=2>
      <GC: managing allocation failure. need 8200 bytes, type=1, action=3>
      <GC: managing allocation failure. need 8200 bytes, type=1, action=4>
      <GC: tried to expand object space over limit>
      <GC: managing allocation failure. need 8200 bytes, type=1, action=5>
      <GC: totally out of heap space>
      started
      <GC: managing allocation failure. need 8 bytes, type=1, action=1>
      <GC: freed 779 objects, 6560 bytes in 2 ms, 7% free (6560/85192)>
        <GC: init&scan: 0 ms, scan handles: 2 ms, sweep: 0 ms, compact: 0 ms>
      <GC: managing allocation failure. need 8 bytes, type=1, action=2>
      <GC: managing allocation failure. need 8 bytes, type=1, action=3>
      <GC: managing allocation failure. need 8 bytes, type=1, action=4>
      <GC: tried to expand object space over limit>
      <GC: managing allocation failure. need 8 bytes, type=1, action=5>
      <GC: totally out of heap space>
      out of memory at loopcnt 770
      <GC: managing allocation failure. need 8 bytes, type=1, action=1>
      <GC: freed 781 objects, 6440 bytes in 2 ms, 7% free (6440/85192)>
        <GC: init&scan: 0 ms, scan handles: 2 ms, sweep: 0 ms, compact: 0 ms>
      <GC: managing allocation failure. need 8 bytes, type=1, action=2>
      <GC: managing allocation failure. need 8 bytes, type=1, action=3>
      <GC: managing allocation failure. need 8 bytes, type=1, action=4>
      <GC: tried to expand object space over limit>
      <GC: managing allocation failure. need 8 bytes, type=1, action=5>
      <GC: totally out of heap space>
      out of memory at loopcnt 1541
      ...

      class sample:


      public class lotsofobjects extends Thread {

          public static void main(String args[]) {
              System.out.println("started");
              int loopcnt;
              Object s;
              for(loopcnt=1; ;loopcnt++ ){
                  Object t = null;
                  try {
                      t = new Object();
                      if (loopcnt%1000 == 0) s = new Object();
                  }
                  catch (OutOfMemoryError e) {
                      System.out.println("out of memory at loopcnt " + loopcnt);
                      try {Thread.sleep(44);} catch (InterruptedException y){};
                  }
                  t = null;
              }
          }

      }


            sliangsunw Sheng Liang (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: