哪些参数代表 JVM 内存选项中的内容? [英] Which arguments stand for what in JVM memory options?

查看:16
本文介绍了哪些参数代表 JVM 内存选项中的内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有很多 JVM 参数会影响 JVM 的内存使用,例如 -Xms、-Xmx、-Xns、-XX:MaxPermSize...

There a lot of JVM arguments that affect the JVM's memory usage like -Xms, -Xmx, -Xns, -XX:MaxPermSize...

  • 他们是做什么的?
  • 还有吗?
  • 遇到什么错误(如OutOfMemoryErrorStackOverflowError...)时我必须增加哪一项?
  • What do they do?
  • Are there any more?
  • Which one do I have to increase when I get what error (e.g. OutOfMemoryError, StackOverflowError...)?

我找不到适合他们的备忘单 - 让我们在这里创建一个.

I cannot find a good cheat sheet for them - let's create one here.

推荐答案

-Xms: 此选项设置初始和最小 Java 堆大小.

-Xms: this option sets the initial and minimum Java heap size.

-Xmx:此选项设置最大 Java 堆大小.Java 堆(堆")是内存的一部分,其中内存块被分配给对象并在垃圾回收期间被释放.

-Xmx: This option sets the maximum Java heap size. The Java heap (the "heap") is the part of the memory where blocks of memory are allocated to objects and freed during garbage collection.

-XX:PermSize: -XX:MaxPermSize: 用于设置永久生成的大小.永久空间是存储类、方法、内部化字符串和 VM 使用的类似对象的位置,并且永远不会被释放(因此得名).

-XX:PermSize: -XX:MaxPermSize: are used to set size for Permanent Generation. The permanent space is where are stored the class, methods, internalized strings, and similar objects used by the VM and never deallocated (hence the name).

-Xss: 设置线程堆栈大小.线程堆栈是为每个 Java 线程分配的内存区域,供其内部使用.这是线程存储其本地执行状态的地方.

-Xss: sets the thread stack size. Thread stacks are memory areas allocated for each Java thread for their internal use. This is where the thread stores its local execution state.

-Xns: 设置托儿所大小.JRockit JVM 在使用分代垃圾收集模型时使用托儿所,即当动态垃圾收集器确定应该使用分代垃圾收集模型或静态分代并发垃圾收集器(-Xgc:gencon)已选择.您还可以在运行动态垃圾收集器 (-XgcPrio) 时使用 -Xns 设置静态托儿所大小.

-Xns: sets the nursery size. the JRockit JVM uses a nursery when the generational garbage collection model is used, that is, when the dynamic garbage collector has determined that the generational garbage collection model should be used or when the static generational concurrent garbage collector ( -Xgc : gencon) has been selected. You can also use -Xns to set a static nursery size when running a dynamic garbage collector (-XgcPrio).

  • 如果您收到 java.lang.OutOfMemoryError: Java heap space,则更改 -Xmx 的值>-Xms.

如果您遇到 java.lang.OutOfMemoryError: PermGen space,请尝试增加 - XX:MaxPermSize 值.

如果您遇到 java.lang.StackOverflowError,请尝试增加 -Xss 值.增加堆栈大小可能会有所帮助,但您也应该查看您的代码.

if you are getting java.lang.StackOverflowError than try increasing the -Xss value. It may be helpful by increasing the stack size but you should have a look at your code as well.

这篇关于哪些参数代表 JVM 内存选项中的内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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