UseCompressedOops JVM标志做什么以及何时应该使用它? [英] What does the UseCompressedOops JVM flag do and when should I use it?

查看:174
本文介绍了UseCompressedOops JVM标志做什么以及何时应该使用它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

热点JVM标志 -XX:+ UseCompressedOops 做什么以及何时应该使用它?在64位Java实例上使用它时(不使用它),我会看到哪种性能和内存使用差异?

What does the hotspot JVM flag -XX:+UseCompressedOops do and when should I use it? What sort of performance and memory-usage differences will I see when using it on a 64-bit Java instance (vs. not using it)?

推荐答案

去年大多数HotSpot JVM默认启用它。此选项允许在64位JVM中引用为32位,并且访问接近32 GB的堆。 (超过32位指针可以)(你也可以有近乎无限的堆内存)。这可以节省大量内存并可能提高性能。

Most HotSpot JVM in the last year have had it on by default. This option allows references to be 32-bit in a 64-bit JVM and access close to 32 GB of heap. (more than 32-bit pointers can) (You can have near unlimited off heap memory as well). This can save a significant amount of memory and potentially improve performance.

如果您想使用此选项,我建议您更新到默认情况下打开它的版本可能是一个很好的理由,比如bug,为什么以前没有启用它。尝试使用Java 6更新23或Java 7更新5.

If you want to use this option I suggest you update to a version which has it on by default as there may have been a good reason, such as bugs, why it wasn't enabled previously. Try Java 6 update 23 or Java 7 update 5.

简而言之,请不要打开它,使用默认启用它的版本。

In short, don't turn it on, use a version which has it on by default.

更新:

在Java 8中,您可以选择设置 -XX:ObjectAlignmentInBytes = 并且实际上如果你将大小堆到64 GB它将使用 -XX:ObjectAlignmentInBytes = 16 并且仍然使用32位引用。

In Java 8 you have the option to set the -XX:ObjectAlignmentInBytes= and in fact if you heap size to 64 GB it will use -XX:ObjectAlignmentInBytes=16 and still use 32-bit references.

这篇关于UseCompressedOops JVM标志做什么以及何时应该使用它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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