Java -Xmn jvm 选项代表什么

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23880891/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-14 08:48:25  来源:igfitidea点击:

What does -Xmn jvm option stands for

javajvm-arguments

提问by Bhushan

I tried searching the internet about -Xmn option, without success.

我尝试在互联网上搜索有关 -Xmn 选项的信息,但没有成功。

Can someone please explain what this stands for and how can I use it to tune JVM?

有人可以解释一下这代表什么以及我如何使用它来调整 JVM?

采纳答案by awksp

From here:

这里:

-Xmn : the size of the heap for the young generation

Young generation represents all the objects which have a short life of time. Young generation objects are in a specific location into the heap, where the garbage collector will pass often. All new objects are created into the young generation region (called "eden"). When an object survive is still "alive" after more than 2-3 gc cleaning, then it will be swap has an "old generation" : they are "survivor".

-Xmn : 年轻代的堆大小

年轻代代表所有生命周期较短的对象。年轻代对象位于堆中的特定位置,垃圾收集器将经常通过该位置。所有新对象都被创建到年轻代区域(称为“eden”)中。当一个对象在经过 2-3 次以上的 gc 清理后仍然“活着”时,那么它将交换一个“老年代”:它们是“幸存者”。

And a more "official" source from IBM:

来自IBM的更“官方”来源:

-Xmn

Sets the initial and maximum size of the new (nursery) heap to the specified value when using -Xgcpolicy:gencon. Equivalent to setting both -Xmns and -Xmnx. If you set either -Xmns or -Xmnx, you cannot set -Xmn. If you attempt to set -Xmn with either -Xmns or -Xmnx, the VM will not start, returning an error. By default, -Xmn is selected internally according to your system's capability. You can use the -verbose:sizes option to find out the values that the VM is currently using.

-Xmn

使用 -Xgcpolicy:gencon 时,将新(苗圃)堆的初始和最大大小设置为指定值。相当于同时设置 -Xmns 和 -Xmnx。如果您设置了 -Xmns 或 -Xmnx,则无法设置 -Xmn。如果您尝试使用 -Xmns 或 -Xmnx 设置 -Xmn,VM 将不会启动,并返回错误。默认情况下,-Xmn 是根据您系统的能力在内部选择的。您可以使用 -verbose:sizes 选项找出 VM 当前使用的值。

回答by dimoniy

-Xmn: the size of the heap for the young generation Young generation represents all the objects which have a short life of time. Young generation objects are in a specific location into the heap, where the garbage collector will pass often. All new objects are created into the young generation region (called "eden"). When an object survive is still "alive" after more than 2-3 gc cleaning, then it will be swap has an "old generation" : they are "survivor" .

Good size is 33%

-Xmn: 年轻代的堆大小 年轻代代表所有生命周期较短的对象。年轻代对象位于堆中的特定位置,垃圾收集器将经常通过该位置。所有新对象都被创建到年轻代区域(称为“eden”)中。当一个对象经过 2-3 次以上的 gc 清理后仍然“活着”时,那么它就会交换一个“老年代”:它们是“幸存者”。

好的尺寸是 33%

Source

来源

回答by noego

From GC Performance Tuning training documents of Oracle:

来自 Oracle 的 GC Performance Tuning 培训文档:

-Xmn[size]: Size of young generation heap space.

Applications with emphasis on performance tend to use -Xmn to size the young generation, because it combines the use of -XX:MaxNewSize and -XX:NewSizeand almost always explicitly sets -XX:PermSize and -XX:MaxPermSize to the same value.

-Xmn[size]:年轻代堆空间的大小。

强调性能的应用程序倾向于使用 -Xmn 来调整年轻代的大小,因为它结合了 -XX:MaxNewSize 和 -XX:NewSize 的使用,并且几乎总是明确地将 -XX:PermSize 和 -XX:MaxPermSize 设置为相同的值。

In short, it sets the NewSizeand MaxNewSizevalues of New generationto the same value.

简而言之,它将New GenerationNewSizeMaxNewSize值设置为相同的值。