I have reviewed the answer to how to get the min and max heap size settings of a JVM from within a Java program which was helpful, but the accepted answer doesn't appear to answer half of the question. In essence, I want to repo开发者_如何学Gort the -Xms and -Xmx settings that were used when the JVM was launched.
These are the mappings between values you're looking for:
-Xmx=Runtime.getRuntime().maxMemory()
-Xms=Runtime.getRuntime().totalMemory()
Hope this helps.
If you want to get the real JVM arguments this should help you. You can get all JVM arguments with the MXBean:
RuntimeMXBean RuntimemxBean = ManagementFactory.getRuntimeMXBean();
List<String> arguments = RuntimemxBean.getInputArguments();You have to look for the arguments which start with "-Xm(s|x)". The problem is that the value could be something like "256M".
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论