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

G1 uses too much physical memory for BitMap during JVM start-up

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 9
    • hotspot
    • None
    • gc

      A simple test case: "Wait" is a program that just sleeps at start-up

      # by default, G1 is enabled in JDK9
      java -cp . Wait

      # choose a different GC
      java -XX:+UseParallelGC -cp . Wait

      Using ps_mem.py (https://github.com/pixelb/ps_mem) on Linux:

      G1: 120.23 MiB + 0.26 MiB = 120.50 MiB java
      Parallel: 21.87 MiB + 0.20 MiB = 22.07 MiB java

      The 100MB of overhead comes from here:

      G1ConcurrentMark::G1ConcurrentMark() {
         ...
         for (uint i = 0; i < _max_worker_id; ++i) {
           ...
          _count_card_bitmaps[i] = BitMap(card_bm_size, false);
      }

      This loop executes for 23 times with default JVM parameters. Each iteration allocations about 4MB of malloc memory that's zero initialized.

      ----> Is it possible to allocate the BitMap array using anonymous mmap so that (a) it appears as zero initialized so when you read from it you get zeros, (b) no physical memory is allocated until you write into a page? Linux mmap seems to suggest that can be done but I am not 100% sure.

            Unassigned Unassigned
            iklam Ioi Lam
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: