Thomas
Thomas

Reputation: 648

System.gc() calls in Wildfly

I am currently using Wildlfly 10.1. in production and just discovered that we have a lot of gc pause times. Analysis of the gc log exposed that 95% of the gc runs are triggered by System.gc() calls. Our application code does not invoke any of them.

Is this a Wildfly feature?

Or can someone point me in the right direction to figure out if these System.gc() invokations make sense?

Of course, I am aware that there is a number of measures to optimize gc behavoir. I am just asking myself why there are so many System.gc() calls.

Upvotes: 1

Views: 1233

Answers (2)

devops
devops

Reputation: 9179

System.gc() is called by Java RMI or more specifically by sun.misc.GC class - Sourcecode

Default interval is 1 hour. You can set it by using these parameters:

-Dsun.rmi.dgc.client.gcInterval=3600000
-Dsun.rmi.dgc.server.gcInterval=3600000

Setting -XX:+DisableExplicitGC can make your application slower and slower over time.

See also: What is the default Full GC interval in Java 8

Upvotes: 2

the8472
the8472

Reputation: 43042

If you want to find callers for System.gc the most reliable method is to attach a debugger and set a method entry breakpoint on it.

Upvotes: 1

Related Questions