使用大量内存的Java应用程序。使用-Xmx? [英] Java app that uses a lot of memory. Use -Xmx?

查看:328
本文介绍了使用大量内存的Java应用程序。使用-Xmx?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在16G机器上使用大约15G的Java应用程序。我不知道是否应该设置最大堆大小。

I have a java app that uses about 15G on a machine with 16G. I don't know if I should set the max heap size.

如果设置将jvm吃掉所有ram达到极限然后开始垃圾收集并在通过15G堆对象搅拌时停止所有内容?

If set will the jvm eat all the ram up to the limit and then start garbage collecting and stop everything while it churns through 15G of heap objects?

如果没有,jvm会因为没有使用机器上所有可用的ram而损害性能。

If not will the jvm hurt performance by not using all of the available ram on the machine.

我的特定虚拟机是:Java HotSpot(TM)64位服务器虚拟机(版本1.6.0_03-b05,混合模式)。

My specific vm is: Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_03-b05, mixed mode).

谢谢

推荐答案

-Xmx15G 将设置最大堆大小为15 gig。 Java只会在运行时分配它所需的内容。如果您没有设置它,它将只使用默认值。有关默认信息,请参阅此帖

-Xmx15G will set the maximum heap size to 15 gig. Java will only allocate what it needs as it runs. If you don't set it, it will only use the default. For info on the default, see this post.

-Xms15G 将最小堆设置为15 gig。这迫使java在开始执行之前分配15 gig的堆空间,无论它是否需要它。

-Xms15G sets the minimum heap to 15 gig. This forces java to allocate 15 gig of heap space before it starts executing, whether it needs it or not.

通常你可以根据你的方式将它们设置为合适的值'重新调整JVM。

Usually you can set them both to appropriate values depending on how you're tuning the JVM.

这篇关于使用大量内存的Java应用程序。使用-Xmx?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆