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

compacting huge arrays can slow down garbage collection

XMLWordPrintable

    • sparc
    • solaris_2.5.1



      Name: laC46010 Date: 09/11/98



      The following simple test takes about 2 min to complete
      on Ultra-1 (200Mhz, 128Mb RAM, 500Mb swap) under -mx256m specified.
      GC and mostly compacting take most of the time:

        <GC: init&scan: 6 ms, scan handles: 4 ms, sweep: 2 ms, compact: 117269 ms>
                                                                        ^^^^^^

      Effect appears also on some JCK tests which attempt to create OutOfMemoryError
      and sometimes fail due to timeout (for example "expr05001")

      ---------------------------------- a.java -----------------------------------
      public class a
      {
              public static void main(String args[])
              {
                      int len = 31250000;
                      try {
                       int x1[] = new int [len];
                        System.out.println("x1: len=" + len);
                       int x2[] = new int [len];
                        System.out.println("x2: len=" + len);
                       x1[0]=1;
                       x2[0]=2;
                        System.out.println("Success: len=" + len);
                        System.exit(x1[0]+x2[0]);
                       } catch (OutOfMemoryError e) {
                              System.out.println("OutOfMemoryError: len=" + len);
                       }
              }
       
      }
      -----------------------------------------------------------------------------

      > timex /export/ld14/java/dest/jdk1.2fcsI/solaris/bin/java -verbosegc -mx256m a
      <GC: need to expand mark bits to cover 16384 bytes>
      <GC: managing allocation failure: need 125000008 bytes, type=1, action=1>
      <GC: 0 milliseconds since last GC>
      <GC: compactHeap took 4 ms, swap time = 2 ms, blocks_moved=799>
      <GC: 0 explicitly pinned objects, 2 conservatively pinned objects>
      <GC: last free block at 0xe235461c of length 702944>
      <GC: last free block is at end>
      <GC: freed 1004 objects, 67704 bytes in 14 ms, 83% free (702944/838856)>
        <GC: init&scan: 0 ms, scan handles: 7 ms, sweep: 2 ms, compact: 5 ms>
        <GC: 0 register-marked objects, 2 stack-marked objects>
        <GC: 0 register-marked handles, 34 stack-marked handles>
        <GC: refs: soft 0 (age >= 32), weak 0, final 2, phantom 0>
      <GC: managing allocation failure: need 125000008 bytes, type=1, action=2>
      <GC: 22 milliseconds since last GC>
      <GC: expanded object space by 124297216 to 125136072 bytes, -3% free>
      <GC: need to expand mark bits to cover 1942144 bytes>
      <GC: managing allocation failure: need 1032 bytes, type=1, action=1>
      <GC: 10305 milliseconds since last GC>
      <GC: compactHeap took 2 ms, swap time = 2 ms, blocks_moved=0>
      <GC: 0 explicitly pinned objects, 4 conservatively pinned objects>
      <GC: last free block at 0xe9a89f64 of length 152>
      <GC: last free block is at end>
      <GC: freed 0 objects, 0 bytes in 1587 ms, 0% free (152/125136072)>
        <GC: init&scan: 129 ms, scan handles: 1380 ms, sweep: 75 ms, compact: 3 ms>
        <GC: 0 register-marked objects, 7 stack-marked objects>
        <GC: 0 register-marked handles, 60 stack-marked handles>
        <GC: refs: soft 0 (age >= 6), weak 0, final 0, phantom 0>
      <GC: managing allocation failure: need 1032 bytes, type=1, action=2>
      <GC: 1627 milliseconds since last GC>
      <GC: expanded object space by 4194304 to 129330376 bytes, 3% free>
      <GC: need to expand mark bits to cover 57984 bytes>
      x1: len=31250000
      <GC: managing allocation failure: need 125000008 bytes, type=1, action=1>
      <GC: 730 milliseconds since last GC>
      <GC: compactHeap took 117259 ms, swap time = 1 ms, blocks_moved=21>
      <GC: 0 explicitly pinned objects, 4 conservatively pinned objects>
      <GC: last free block at 0xe9a8a214 of length 4193768>
      <GC: last free block is at end>
      <GC: freed 30 objects, 2408 bytes in 117281 ms, 3% free (4193768/129330376)>
        <GC: init&scan: 6 ms, scan handles: 4 ms, sweep: 2 ms, compact: 117269 ms>
        <GC: 0 register-marked objects, 7 stack-marked objects>
        <GC: 0 register-marked handles, 63 stack-marked handles>
        <GC: refs: soft 0 (age >= 4), weak 0, final 0, phantom 0>
      <GC: managing allocation failure: need 125000008 bytes, type=1, action=2>
      <GC: 117322 milliseconds since last GC>
      <GC: tried to expand object space over limit>
      <GC: managing allocation failure: need 125000008 bytes, type=1, action=3>
      <GC: 1 milliseconds since last GC>
      <GC: clearing all remaining soft refs (125000008)>
      <GC: compactHeap took 13 ms, swap time = 12 ms, blocks_moved=0>
      <GC: 0 explicitly pinned objects, 4 conservatively pinned objects>
      <GC: last free block at 0xe9a8a214 of length 4193768>
      <GC: last free block is at end>
      <GC: freed 0 objects, 0 bytes in 1880 ms, 3% free (4193768/129330376)>
        <GC: init&scan: 1436 ms, scan handles: 429 ms, sweep: 1 ms, compact: 14 ms>
        <GC: 0 register-marked objects, 7 stack-marked objects>
        <GC: 0 register-marked handles, 55 stack-marked handles>
        <GC: refs: soft 0 (age >= 4), weak 0, final 0, phantom 0>
      <GC: compactHeap took 2 ms, swap time = 2 ms, blocks_moved=0>
      <GC: 0 explicitly pinned objects, 4 conservatively pinned objects>
      <GC: last free block at 0xe9a8a214 of length 4193768>
      <GC: last free block is at end>
      <GC: freed 0 objects, 0 bytes in 18 ms, 3% free (4193768/129330376)>
        <GC: init&scan: 9 ms, scan handles: 4 ms, sweep: 2 ms, compact: 3 ms>
        <GC: 0 register-marked objects, 7 stack-marked objects>
        <GC: 0 register-marked handles, 58 stack-marked handles>
        <GC: refs: soft 0 (age >= 4), weak 0, final 0, phantom 0>
      <GC: managing allocation failure: need 125000008 bytes, type=1, action=4>
      <GC: 1903 milliseconds since last GC>
      <GC: totally out of heap space>
      OutOfMemoryError: len=31250000

      real 2:14.13
      user 1.97
      sys 2.59


      Hook 5(hook5): test
      ======================================================================

            apalanissunw Anand Palaniswamy (Inactive)
            leosunw Leo Leo (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: