Why does the JVM always start with a FULL GC?

I am running customization tests in a web application that runs on JBoss AS5.

I create various scenarios using JMeter, starting with low load and load load.

I noticed that the GC log always starts with a full GC.

Can someone explain me this behavior?

Thanks in advance.

FWIW, here is a snippet from the GC magazine:

17.560: [Full GC [PSYoungGen: 44456K->0K(458752K)] [ParOldGen: 0K->4385K(1572864K)] 44456K->4385K(2031616K) [PSPermGen: 11565K->11555K(262144K)], 0.9226691 secs] 72.478: [GC [PSYoungGen: 393216K->30720K(458752K)] 397601K->35105K(2031616K), 0.1787110 secs] 112.137: [GC [PSYoungGen: 423936K->38912K(458752K)] 428321K->43297K(2031616K), 0.2197971 secs] 188.297: [GC [PSYoungGen: 432128K->54272K(458752K)] 436513K->58657K(2031616K), 0.3034273 secs] 309.100: [GC [PSYoungGen: 447488K->60416K(458752K)] 451873K->64801K(2031616K), 0.3111470 secs] 430.354: [GC [PSYoungGen: 453632K->65536K(454848K)] 458017K->72129K(2027712K), 0.3374716 secs] 546.078: [GC [PSYoungGen: 454848K->65536K(415104K)] 461441K->78881K(1987968K), 0.3746511 secs] 652.116: [GC [PSYoungGen: 415104K->40960K(436928K)] 428449K->88641K(2009792K), 0.3895185 secs] 765.134: [GC [PSYoungGen: 390528K->28672K(437632K)] 438209K->94882K(2010496K), 0.2703870 secs] 870.726: [GC [PSYoungGen: 380800K->23552K(375680K)] 447010K->102114K(1948544K), 0.1948568 secs] 976.144: [GC [PSYoungGen: 375680K->18432K(436096K)] 454242K->110306K(2008960K), 0.1734677 secs] 
+4
source share
2 answers

With the help of Peter Johnson from the Jboss community. I was able to find out the answer to this question.

I am writing here to share it with you.

The call to System.gc () is encoded to the application server (or to one of the libraries that it uses), I know that RMI libraries like to make GC calls), I suspect that it is going from bootstrap to the server application. I think he could do another GC or two after deployment, or other major initialization operations. I think the idea is to keep the heap as clean as possible before handling user requests. Of course, that made sense many years ago when the servers didn’t have that much memory and the heaps were smaller. I saw this behavior in JBoss AS from version 4.0.x to 5.x (I did not control the behavior of the GC on 6).

0
source

It doesn't always start with GC, you may have a program that never has GCs.

However, when starting the JVM, it uses the minimum amount of memory by default.

The application creates data structures, and a high percentage of objects will be saved. This is not normal behavior, and the surviving space may be exhausted. The JVM is configured to discard most objects that were recently created. When the exhausted space is exhausted, Full GC is triggered.

Since you know how much memory your application will grow, you can use an option like

 -ms512m -mx1g 

The full GC will be removed and you will collect less often.

+2
source

All Articles