Complete garbage collection occurs without a complete collection of the old generation

I have three questions regarding garbage collection

  • I am trying to learn garbage collection in my application, and I can notice that a full GC has occurred. Studying GC magazines, I found that the old gene didn’t even use half of the allocated memory. Then why do we need a full GC. Is there another algorithm that uses the JVM that frees memory, even if the old gene is not fully used?

  • What can be called a good trend GC. I mean, if a full GC happens every 10-15 minutes, I can call the application in good condition. I want to know how the perfect GC should be for the application. I know this depends a lot on the application, but there must be something that can be called perfect.

  • I did not set the NewSize or Newratio property. By default, NewRatio in the machine seems to be 2. But I see that my young gene uses only 1/4 of the heap size, and the rest is used by the shadow gen. How is this possible? All I defined is Xmx and permsize.
+4
source share
1 answer

The main collection can happen for several reasons, in most cases you can see the reason using jstat -gccause.

-System.gc(), , , . - - PermGen - , CMSIncrementalMode, , .

System.gc() , -XX: + DisableExcplicitGC , .

-

, . . , GC, /. , ? ? , , ? , - , .

-

, JVM .. ..... , GC , , -XX: + UseAdaptiveSizePolicy .

+1

All Articles