Java app that uses a lot of memory. Use -Xmx?(使用大量内存的 Java 应用程序.使用-Xmx?)
问题描述
我有一个 java 应用程序,它在 16G 的机器上使用大约 15G.我不知道是否应该设置最大堆大小.
如果设置了 jvm 是否会吃掉所有的内存,然后开始垃圾收集并在它翻腾 15G 的堆对象时停止一切?
如果不是这样,jvm 会因为不使用机器上所有可用的内存而损害性能.
我的特定虚拟机是:Java HotSpot(TM) 64 位服务器虚拟机(内部版本 1.6.0_03-b05,混合模式).
谢谢
-Xmx15G 将最大堆大小设置为 15 gig.Java 只会在运行时分配它需要的东西.如果不设置,它只会使用默认值.有关默认值的信息,请参阅这篇文章.p>
-Xms15G 将最小堆设置为 15 gig.这会强制 java 在开始执行之前分配 15 gig 的堆空间,无论它是否需要.
通常您可以将它们都设置为适当的值,具体取决于您调整 JVM 的方式.
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.
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?
If not will the jvm hurt performance by not using all of the available ram on the machine.
My specific vm is: Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_03-b05, mixed mode).
Thanks
-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 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.
Usually you can set them both to appropriate values depending on how you're tuning the JVM.
这篇关于使用大量内存的 Java 应用程序.使用-Xmx?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:使用大量内存的 Java 应用程序.使用-Xmx?
基础教程推荐
- 无法复制:“比较方法违反了它的一般约定!" 2022-01-01
- 存储 20 位数字的数据类型 2022-01-01
- RabbitMQ:消息保持“未确认"; 2022-01-01
- 问题http://apache.org/xml/features/xinclude测试日志4j 2 2022-01-01
- Struts2 URL 无法访问 2022-01-01
- 修改 void 函数的输入参数,然后读取 2022-01-01
- 如何对 Java Hashmap 中的值求和 2022-01-01
- REST Web 服务返回 415 - 不支持的媒体类型 2022-01-01
- 使用堆栈算法进行括号/括号匹配 2022-01-01
- Spring AOP错误无法懒惰地为此建议构建thisJoinPoin 2022-09-13
