如何确定 Java 应用程序中的 JVM 最小堆大小?
我已经查看了 如何从 Java 程序中获取 JVM 的最小和最大堆大小设置 这很有帮助,但接受的答案似乎并没有回答一半的问题。本质上,我想报告 JVM 启动时使用的 -Xms 和 -Xmx 设置。
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 report the -Xms and -Xmx settings that were used when the JVM was launched.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果你想获得真正的 JVM 参数,这应该对你有帮助。您可以使用 MXBean 获取所有 JVM 参数:
您必须查找以“-Xm(s|x)”开头的参数。问题是该值可能类似于“256M”。
If you want to get the real JVM arguments this should help you. You can get all JVM arguments with the MXBean:
You have to look for the arguments which start with "-Xm(s|x)". The problem is that the value could be something like "256M".
这些是您正在寻找的值之间的映射:
希望这有帮助。
These are the mappings between values you're looking for:
Hope this helps.