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

Small young generation specification leads to 0-byte eden

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P5 P5
    • 9
    • 7u25, 8
    • hotspot
    • None
    • I can reproduce this on Solaris/i586 JDK-7u25 (HotSpot 23.25-b02) and JDK-8 (HotSpot 25.0-b42) and MacOSX/x64, JDK-7 (HotSpot 23.25-b02).

    • gc
    • generic
    • generic

      I was trying to make my young generation small and noticed that if I make the young generation too small, the Universe::print() mis-prints the percentage of the eden that is used.

          telling $ $Deployed/JDK-7/bin/java -showversion -Xmn512k -Xmx10m -XX:+PrintGCDetails SystemGC
          java version "1.7.0_25"
          Java(TM) SE Runtime Environment (build 1.7.0_25-b33)
          Java HotSpot(TM) Server VM (build 23.25-b02, mixed mode)

          [GC [PSYoungGen: 0K->0K(256K)] 326K->326K(9984K), 0.0005796 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
          [Full GC (System) [PSYoungGen: 0K->0K(256K)] [ParOldGen: 326K->230K(9728K)] 326K->230K(9984K) [PSPermGen: 1714K->1712K(16384K)], 0.0091519 secs] [Times: user=0.01 sys=0.00, real=0.01 secs]
          Heap
           PSYoungGen total 256K, used 0K [0xfa780000, 0xfa800000, 0xfa800000)
            eden space 0K, -2147483648% used [0xfa780000,0xfa780000,0xfa780000)
            from space 256K, 0% used [0xfa780000,0xfa780000,0xfa7c0000)
            to space 256K, 0% used [0xfa7c0000,0xfa7c0000,0xfa800000)
           ParOldGen total 9728K, used 230K [0xf9e00000, 0xfa780000, 0xfa780000)
            object space 9728K, 2% used [0xf9e00000,0xf9e39ba8,0xfa780000)
           PSPermGen total 16384K, used 1719K [0xf5e00000, 0xf6e00000, 0xf9e00000)
            object space 16384K, 10% used [0xf5e00000,0xf5fadea8,0xf6e00000)

      Note the "-2147483648%" in there. SystemGC is a tiny program that just calls System.gc().

      This is with

          telling $ $Deployed/JDK-7/bin/java -Xinternalversion
          Java HotSpot(TM) Server VM (23.25-b02) for solaris-x86 JRE (1.7.0_25-b33), built on Jun 17 2013 22:30:57 by "" with Sun Studio 12u1

      I just tried it with

          java version "1.8.0-ea"
          Java(TM) SE Runtime Environment (build 1.8.0-ea-b100)
          Java HotSpot(TM) Server VM (build 25.0-b42, mixed mode)

      and the bug is still there.

      The story on my MacOSX box is worse

          carcharor $ $Deployed/JDK-7/bin/java -showversion -Xmn512k -Xmx10m -XX:+PrintGCDetails SystemGC
          java version "1.7.0_25"
          Java(TM) SE Runtime Environment (build 1.7.0_25-b33)
          Java HotSpot(TM) 64-Bit Server VM (build 23.25-b02, mixed mode)

          #
          # A fatal error has been detected by the Java Runtime Environment:
          #
          # SIGSEGV (0xb) at pc=0x000000010187dee8, pid=99365, tid=6403
          #
          # JRE version: 7.0_25-b33
          # Java VM: Java HotSpot(TM) 64-Bit Server VM (23.25-b02 mixed mode bsd-amd64 compressed oops)
          # Problematic frame:
          # V [libjvm.dylib+0x7dee8]
          #
          # Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
          #
          # An error report file with more information is saved as:
          # /Users/pbkessle/Play/Java/hs_err_pid99365.log
          #
          # If you would like to submit a bug report, please visit:
          # http://bugreport.sun.com/bugreport/crash.jsp
          #
          Abort trap

      That's with

          carcharor $ $Deployed/JDK-7/bin/java -Xinternalversion
          Java HotSpot(TM) 64-Bit Server VM (23.25-b02) for bsd-amd64 JRE (1.7.0_25-b33), built on Jun 17 2013 21:35:53 by "java_re" with gcc 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)

      I have to go *all the way :-)* to -Xmn756k before it will run, and then it displays the same bug as my Solaris/i586 box

          carcharor $ $Deployed/JDK-7/bin/java -showversion -Xmn756k -Xmx10m -XX:+PrintGCDetails SystemGC
          java version "1.7.0_25"
          Java(TM) SE Runtime Environment (build 1.7.0_25-b33)
          Java HotSpot(TM) 64-Bit Server VM (build 23.25-b02, mixed mode)

          [GC [PSYoungGen: 0K->0K(512K)] 657K->657K(9728K), 0.0013460 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
          [Full GC (System) [PSYoungGen: 0K->0K(512K)] [ParOldGen: 657K->292K(9216K)] 657K->292K(9728K) [PSPermGen: 2666K->2664K(21504K)], 0.0224600 secs] [Times: user=0.02 sys=0.00, real=0.02 secs]
          Heap
           PSYoungGen total 512K, used 0K [0x00000007fff00000, 0x0000000800000000, 0x0000000800000000)
            eden space 0K, -2147483648% used [0x00000007fff00000,0x00000007fff00000,0x00000007fff00000)
            from space 512K, 0% used [0x00000007fff00000,0x00000007fff00000,0x00000007fff80000)
            to space 512K, 0% used [0x00000007fff80000,0x00000007fff80000,0x0000000800000000)
           ParOldGen total 9216K, used 293K [0x00000007ff600000, 0x00000007fff00000, 0x00000007fff00000)
            object space 9216K, 3% used [0x00000007ff600000,0x00000007ff649698,0x00000007fff00000)
           PSPermGen total 21504K, used 2675K [0x00000007fa400000, 0x00000007fb900000, 0x00000007ff600000)
            object space 21504K, 12% used [0x00000007fa400000,0x00000007fa69cca8,0x00000007fb900000)

      I think the problem is in src/share/vm/gc_implementation/shared/mutableSpace.cpp

          237 void MutableSpace::print_short_on( outputStream* st) const {
          238 st->print(" space " SIZE_FORMAT "K, %d%% used", capacity_in_bytes() / K,
          239 (int) ((double) used_in_bytes() * 100 / capacity_in_bytes()));
          240 }

      and the problem must be when capacity_in_bytes() is small. In fact, the bottom(), top() and end() of the eden are all the same, so its capacity_in_bytes() really is 0. Bleah, so now it's not a printing problem, it's a space-sizing problem. That code is too complicated for its own good.

            Unassigned Unassigned
            pbk Peter Kessler
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: