考虑下面的命令行
java -Xms128m -Xms256m myapp.jar
JVM 最小内存(Xms
选项)适用哪些设置:128m 或 256m?
Which settings will apply for JVM Minimum memory (Xms
option) : 128m or 256m ?
取决于 JVM,也许是版本......也许甚至可能是你当时桌上有多少个回形针.它甚至可能不起作用.不要那样做.
Depends on the JVM, perhaps the version...perhaps even how many paper clips you have on your desk at the time. It might not even work. Don't do that.
如果由于某种原因它超出了您的控制范围,请以与运行 jar 相同的方式编译和运行它.但请注意,依赖选项的顺序是一个非常糟糕的主意.
If it's out of your control for some reason, compile and run this the same way you'd run your jar. But be warned, relying on the order of the options is a really bad idea.
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 运行时选项:优先顺序是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!