Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the default schedule of GC in java 6? (1.6.0-25)

I'd like to know what is approximately the default schedule GC runs on java 6 (64bit) machines? I know it can be triggered without any schedule, but still, what would be the default behaviour?

I don't know if the java runs as with -server option. How can I check that? I don't see it in the java process command (when I do 'ps ax|grep java'), but still, can it be run in server mode anyway? Does it depend on a jvm installed, or the type of the physical server? Please let me know how can I know this.

like image 430
javagirl Avatar asked Dec 01 '25 09:12

javagirl


1 Answers

First, to print all the default JVM settings, use : java -XX:+PrintFlagsFinal -version

By default, JVM Hotspot runs in the -client mode.

You can use the following parameters when starting your script -XX:+UnlockDiagnosticVMOptions -XX:+LogVMOutput -XX:LogFile=jvm.log to obtain a log containing all the properties/arguments set at the VM startup.

Regarding the GC, the defaults are determined by the JVM Ergonomics, see Java SE 6 HotSpot[tm] Virtual Machine Garbage Collection Tuning. In short :

If not otherwise set on the command line, the initial and maximum heap sizes are calculated based on the amount of memory on the machine, the default maximum heap size will not exceed 1GB, regardless of how much memory is installed on the machine.

In the same document, the chosen GC algorithm depends on the hardware setup, the VM will decide between Serial and Parallel collectors. To see which one is running in the end, enable GC logging.

And, you should check out the following Q/A: How is the default java heap size determined?

like image 111
Aleš Avatar answered Dec 02 '25 22:12

Aleš