-
Bug
-
Resolution: Fixed
-
P3
-
None
-
b50
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8017753 | 8 | Bengt Rutisson | P3 | Resolved | Fixed | b96 |
JDK-8019708 | 7u60 | Bengt Rutisson | P3 | Resolved | Fixed | b01 |
JDK-8019442 | 7u45 | Bengt Rutisson | P3 | Closed | Fixed | b01 |
JDK-8017591 | 7u40 | Bengt Rutisson | P3 | Resolved | Fixed | b31 |
JDK-8017038 | hs25 | Bengt Rutisson | P3 | Resolved | Fixed | b38 |
In the constructor for the ConcurrentMark class in G1 we set up one bit map per worker thread:
for (uint i = 0; i < _max_worker_id; ++i) {
...
_count_card_bitmaps[i] = BitMap(card_bm_size, false);
...
}
Each of these bitmaps are malloced, which means that the amount of C-heap we require grows with the number of GC worker threads we have. On a machine with many CPUs we get many worker threads by default. For example, on scaaa007 I get 79 GC worker threads. The size of the bitmaps also scale with the heap size, so since this large machine has a lot of memory we get a large default heap as well.
Here is the output from just running java -version with G1 on scaaa007:
$ java -d64 -XX:+UseG1GC -XX:+PrintMallocStatistics -version
java version "1.8.0-ea-fastdebug"
Java(TM) SE Runtime Environment (build 1.8.0-ea-fastdebug-b92)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b34-fastdebug, mixed mode)
allocation stats: 35199 mallocs (221MB), 13989 frees (0MB), 35MB resrc
We malloc 221MB just by starting the VM. Most of the large allocations are due to the BitMap allocations. I have a patch that changes the BitMap allocations to use the ArrayAllocator instead. That class uses mmap on Solaris if the size is larger than 64K.
With this patch the output looks like this:
$ java -d64 -XX:+UseG1GC -XX:+PrintMallocStatistics -version
java version "1.8.0-ea-fastdebug"
Java(TM) SE Runtime Environment (build 1.8.0-ea-fastdebug-b93)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b34-internal-201306130943.brutisso.hs-gc-g1-mmap-fastdebug, mixed mode)
allocation stats: 35217 mallocs (31MB), 14031 frees (0MB), 35MB resrc
We are down to 31MB.
Note that the ArrayAllocator only has this effect on Solaris machines. Also note that I have not reduced the total amount of memory, just moved it from the C-heap to mapped memory.
- backported by
-
JDK-8017038 G1: Use ArrayAllocator for BitMaps
- Resolved
-
JDK-8017591 G1: Use ArrayAllocator for BitMaps
- Resolved
-
JDK-8017753 G1: Use ArrayAllocator for BitMaps
- Resolved
-
JDK-8019708 G1: Use ArrayAllocator for BitMaps
- Resolved
-
JDK-8019442 G1: Use ArrayAllocator for BitMaps
- Closed
- relates to
-
JDK-8058446 G1 Hot card cache should use ArrayAllocator to allocate the cache array
- Resolved
(1 relates to)