简体   繁体   中英

Troubleshooting JVM heap size setting not propagating to application

Say that you have a Windows client where you have configured the JVM through javacpl.exe to have a larger maximum heap size, such as -Xmx1024m . If the application you are running (in a web browser) is still complaining that the memory size is not above value Y , a value that is hardcoded into the application to check, and we assume that we know that this check to be functional and correct, what steps can be taken to see why the app in question is not "getting" this modified heap size setting?

edit One possible cause of this is if you set a 32 bit JRE to more than 2 Gb (or so) of memory, as it will not handle it. 1024 should propagate, and my way of solving this was simply to disable different JRE's that I found on the system until I found out which one was being used.

You need to verify which JVM arguments are being passed into the VM during the startup.

  • The easiest way to is to run jconsole , which will attach to the running VM and where you can see all the startup parameters, current Heap size, etc. jconsole comes with your VM distribution, you can find it in the JVM_HOME/bin/ directory already installed.

  • another option is to enable JVM logging -XX:+UnlockDiagnosticVMOptions -XX:+LogVMOutput -XX:LogFile=jvm.log , the jvm.log will again show all the startup scripts.

Also, try to set both -Xmx and -Xms to the same value, that way the initial Heap size will be your desired size.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM