G1 Garbage Collector: Why is the survival space always full?

Here is the result of the command jmap -heap:

Survivor Space:
   regions  = 52
   capacity = 54525952 (52.0MB)
   used     = 54525952 (52.0MB)
   free     = 0 (0.0MB)
   100.0% used

I executed it many times, and I found that the value is capacityalways equal used.

My question is: why is the surviving space always full (and so little)? I have indicated -Xmx2200m -Xms2200m -Xmn1100m. (I expect that the space for the survivors should be 220 M, which means that there should be more space for the surviving region)

- update -

Full jheap output:

Garbage-First (G1) GC with 2 thread(s)

Heap Configuration:
   MinHeapFreeRatio         = 40
   MaxHeapFreeRatio         = 70
   MaxHeapSize              = 2306867200 (2200.0MB)
   NewSize                  = 1153433600 (1100.0MB)
   MaxNewSize               = 1153433600 (1100.0MB)
   OldSize                  = 4194304 (4.0MB)
   NewRatio                 = 2
   SurvivorRatio            = 8
   MetaspaceSize            = 16777216 (16.0MB)
   CompressedClassSpaceSize = 1073741824 (1024.0MB)
   MaxMetaspaceSize         = 4294963200 (4095.99609375MB)
   G1HeapRegionSize         = 1048576 (1.0MB)

Heap Usage:
G1 Heap:
   regions  = 14488
   capacity = 15191769088 (14488.0MB)
   used     = 1083703304 (1033.5000076293945MB)
   free     = 14108065784 (13454.499992370605MB)
   7.13348983730946% used
G1 Young Generation:
Eden Space:
   regions  = 988
   capacity = 1163919360 (1110.0MB)
   used     = 1035993088 (988.0MB)
   free     = 127926272 (122.0MB)
   89.009009009009% used
Survivor Space:
   regions  = 45
   capacity = 47185920 (45.0MB)
   used     = 47185920 (45.0MB)
   free     = 0 (0.0MB)
   100.0% used
G1 Old Generation:
   regions  = 2
   capacity = 1095761920 (1045.0MB)
   used     = 524296 (0.5000076293945312MB)
   free     = 1095237624 (1044.4999923706055MB)
   0.04784762003775419% used

30424 interned Strings occupying 3027304 bytes.
+4
source share
2 answers

My observations.

  • G1GC , . Xmn ( ).

  • -Xms -Xmx

  • /2048. 4G, 2 2 , 1 .

  • , : -XX:G1HeapRegionSize=n, XX:MaxGCPauseMillis=m, -XX:ParallelGCThreads=n, -XX:ConcGCThreads=n -Xms and -Xmx

SE infoQ ,

Oracle

G1 GC, :

Young Generation Size: -Xmn , -XX: NewRatio. .

: , .

+2

, , Eden Space ( , Young GC).

GC . Gen, Eden Space .

, , , , .

0

Source: https://habr.com/ru/post/1614532/


All Articles