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

Objects stay in survivor space and not tenured to old gen.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • tbd
    • 7u21
    • hotspot
    • gc
    • linux_ubuntu

      FULL PRODUCT VERSION :
      OpenJDK Server VM (build 22.0-b10, mixed mode)

      FULL OS VERSION :
      x86_64 GNU/Linux

      A DESCRIPTION OF THE PROBLEM :
      We are investigating a gradual increase of ParNew collection cpu cost over the lifetime of an application. The problem was isolated in a test application showing that with -XX:MaxTenuringThreshold set to any value > 16 the objects in the survivor space age 15 are not tenured to old generation until survivor space reaches its desired maximum size. Following JVM settings are used:

      -Xms3000m -Xmx3000m
      -XX:+UseConcMarkSweepGC
      -XX:+UseParNewGC
      -XX:MaxTenuringThreshold=17
      -XX:NewSize=1400m
      -XX:SurvivorRatio=2
      -verbose:gc
      -server
      -XX:+PrintGCDateStamps
      -XX:+PrintGCDetails
      -XX:+PrintGCTimeStamps
      -XX:+PrintTenuringDistribution
      -XX:TargetSurvivorRatio=90

      The test app (fully code shown below) within several seconds timespan:
      1. Allocates and throws away 1Gb of objects
      2. Allocates and keep references to 1Mb of objects

      The gc.log shows tenuring distribution age 15 (the last one) keeps growing without spilling anything to old gen, this continues until it reaches the desired survivor size mostly occupied by age 15 objects. Only then the objects start to tenure to old gen. ParNew gc cpu cost also keeps growing overtime, supposedly because it needs to copy more and more data between survivor spaces.

      If -XX:MaxTenuringThreshold is set to any value less than 16, then the picture changes and all objects reaching age 15 spill over to old gen and ParNew gc cost keeps constant, as expected.



      THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: Did not try

      THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Yes

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
        public static void main(String[] args) throws Exception {
          List<String> globalList = new ArrayList();
          int count = 0;
          while (true) {
            // Short lived objects
            List<String> list = new ArrayList<String>(20000);
            for (int i = 0; i < 20000; i++) {
              list.add("0123456789" + i);
            }
            // Long lived objects
            for (int i = 0; i < 100; i++) {
              globalList.add("0123456789" + i);
            }
            
            Thread.currentThread().sleep(10);
          }
        }

      ---------- END SOURCE ----------

            Unassigned Unassigned
            mcastegr Mattis Castegren (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: