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

VM crashes when heap is exhausted

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 1.2.2
    • hotspot
    • x86
    • linux



      Name: kaC94536 Date: 12/02/99


      Linux JDK 1.2.2-G VM crashes while executing following test both with JIT and
      without JIT:
          ${TESTBASE}/src/nsk/stress/memory/memleak003
      where:
          TESTBASE=/net/sqesvr/vsn/testbase/testbase_nsk

      The test tries to allocate as much as possible memory in the VM heap.
      The test is treated passed, if the tested VM does not crashes.
      The test was executed on computers with following configuration:
      - Intel Celeron 366MHz, RAM 64Mb, Red Hat Linux 6.0
      - Intel Pentium MMX 200MHz, RAM 32Mb, Red Hat Linux 6.0

      Bug #4239828 with similar test was filed against HotSpot for Win32.

      --------- memleak003.java (some comments are omitted) --------------
      import java.io.*;

      public class memleak003 {
          /**
           * Re-call to the method <code>run(args,out)</code> to make this
           * test compatible to JCK tests.
           */
          public static void main (String[] args) {
      int exitCode = run(args,System.out);
      System.exit(exitCode + 95);
          };

          /**
           * The test's main method: just try to allocate as much memory
           * as possible.
           */
          public static int run (String args[], PrintStream out) {
              Booty[] wallet = new Booty[1024];
              int amount = 1024*1024*2;

              for (int count=0; (count<wallet.length) && (amount>1); count++)
                  try {
                      wallet[count] = new Booty(count,amount);
                  } catch (OutOfMemoryError oops) {
                      amount /= 2;
                  };

      return 0; // PASSED
          };

          /**
           * Array of the type <code>byte[]</code> intended to be put into
           * a pool of similar arrays in order to detain allocated memoty.
           */
          static class Booty {
              byte[] booty;
              int count;
              int amount;

      /**
               * Grab some <code>amount</code> of bytes.
               */
              Booty (int count, int amount) {
                   this.booty = new byte[amount];
                   this.amount = amount;
                   this.count = count;
              };
          };
      }

      --------------------- output (run without JIT) --------------------------
      SIGSEGV 11* segmentation violation
          si_signo [11]: SIGSEGV 11* segmentation violation
          si_errno [0]: Success
          si_code [0]: SI_USER [pid: 0, uid: 0]
              stackpointer=0xbffff7e4

      Full thread dump Classic VM (1.2.2-G, green threads):
          "Finalizer" (TID:0x40e956c8, sys_thread_t:0x8124140, state:CW) prio=8
              at java.lang.Object.wait(Native Method)
              at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:112)
              at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:127)
              at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:174)
          "Reference Handler" (TID:0x40e954a0, sys_thread_t:0x80ed118, state:CW)
      prio=10
              at java.lang.Object.wait(Native Method)
              at java.lang.Object.wait(Object.java:424)
              at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:114)
          "Signal dispatcher" (TID:0x40e954d8, sys_thread_t:0x8104aa0, state:CW)
      prio=5
          "main" (TID:0x40e95388, sys_thread_t:0x804c400, state:R) prio=5
              at memleak003$Booty.<init>(memleak003.java:61)
              at memleak003.run(memleak003.java:40)
              at memleak003.main(memleak003.java:25)
      Monitor Cache Dump:
          java.lang.ref.Reference$Lock@40E954B0/40ECC670: owner "main" (0x804c400) 1
      entry
              Waiting to be notified:
                  "Reference Handler" (0x80ed118)
          java.lang.ref.ReferenceQueue$Lock@40E956D8/40ECCBD0: <unowned>
              Waiting to be notified:
                  "Finalizer" (0x8124140)
      Registered Monitor Dump:
          utf8 hash table: <unowned>
          JNI pinning lock: <unowned>
          JNI global reference lock: owner "main" (0x804c400) 1 entry
          BinClass lock: owner "main" (0x804c400) 1 entry
          Class linking lock: owner "main" (0x804c400) 1 entry
          System class loader lock: <unowned>
          Code rewrite lock: <unowned>
          Heap lock: owner "main" (0x804c400) 1 entry
          Monitor cache lock: owner "main" (0x804c400) 2 entries
          Dynamic loading lock: <unowned>
          Monitor IO lock: <unowned>
          User signal monitor: <unowned>
              Waiting to be notified:
                  "Signal dispatcher" (0x8104aa0)
          Child death monitor: <unowned>
          I/O monitor: <unowned>
          Alarm monitor: <unowned>
              Waiting to be notified:
                  <unknown thread> (0x8056860)
          Thread queue lock: owner "main" (0x804c400) 2 entries
          Monitor registry: owner "main" (0x804c400) 1 entry
      ---------------------------------------------------------------------------
      ======================================================================

            Unassigned Unassigned
            kanisimosunw Konstantin Anisimov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: