12 April 2018

Rightmost duplicated Xmx

Just like it's explained at Stackoverflow question, most JVM take rightmost duplicated java properties values, in particular memory settings:

java -server -Xms256m -Xmx512m -XX:MaxPermSize=256m -Dweblogic.Name=servidor01 -Djava.security.policy=/u04/Middleware/P_WLS12c/product/wlserver/server/lib/weblogic.policy -Dweblogic.ProductionModeEnabled=true -Dweblogic.system.BootIdentityFile=/u04/Admin/domains/dominio/servers/servidor01/data/nodemanager/boot.properties -Dweblogic.nodemanager.ServiceEnabled=true -Dweblogic.nmservice.RotationEnabled=true -Dweblogic.security.SSL.ignoreHostnameVerification=false -Dweblogic.ReverseDNSAllowed=false -Djava.awt.headless=true -Xms2g -Xmx2g -XX:MaxPermSize=2g -Djava.security.egd=file:/dev/./urandom -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintHeapAtGC 

public class TotalMemory
{
 public static void main(String[] args)
 {
 System.out.println("Total Memory: "+Runtime.getRuntime().totalMemory());
 System.out.println("Free Memory: "+Runtime.getRuntime().freeMemory());
 }
}
> java -version; java -Xmx1G -XX:+PrintFlagsFinal -Xmx2G 2>/dev/null | grep MaxHeapSize

The way is parsed: 
for( int i=0; i<argc; i++ ) {
  process_argument(argv[i]);
}
  
(2G of Heap !)

No comments :

Blog Archive

Disclaimer

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.