Java:新一代使用 100%,伊甸园空间使用 100%,来自空间使用 100%

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11245444/
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-10-31 04:23:19  来源:igfitidea点击:

Java: New Generation Used 100%, Eden Space Used 100%, From Space Used 100%

javamemorygarbage-collectionheapjmap

提问by Jasper

jmap -heap gives me output that says:

jmap -heap 给我的输出是:

New Generation Used 100%, Eden Space Used 100%, From Space Used 100%, To Space Used: 0%, Perm Generation Used: 38%

新一代使用 100%,伊甸园空间使用 100%,从空间使用 100%,到空间使用:0%,永久代使用:38%

Is this 100% of New, Eden, From space - a problem?

这是 100% 的 New, Eden, From space - 有问题吗?

My JAVA OPTS are: -Xms10240m -Xmx14336m -XX:PermSize=192m -XX:MaxPermSize=256m -XX:NewSize=8192m -XX:MaxNewSize=8192m -XX:-DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=60

我的 JAVA OPTS 是:-Xms10240m -Xmx14336m -XX:PermSize=192m -XX:MaxPermSize=256m -XX:NewSize=8192m -XX:MaxNewSize=8192m -XX:-DisableExplicitGC -XX: +UseConcXX:SweepancyGC0CUPCUP=192m -XX:MaxPermSize=256m

I see a lot of quick Garbage Collection. But no memory leaks using tools like JConsole

我看到很多快速垃圾收集。但是使用 JConsole 之类的工具没有内存泄漏

The Memory Usage can be seen here: http://tinypic.com/view.php?pic=wo213&s=6

内存使用情况可以在这里看到:http: //tinypic.com/view.php?pic=wo213&s=6

JDK 1.6 is in use.

JDK 1.6 正在使用中。

回答by Alexey Ragozin

Well that is how generational collection works. You have young space (eden, from, to) and old space (tenure, perm). Young space is smaller. Once young space is full (your case) - thing called minor GC (young GC) is happening.

那么这就是分代收集的工作方式。你有年轻的空间(伊甸园,从,到)和旧的空间(任期,烫发)。年轻的空间更小。一旦年轻空间已满(您的情况) - 称为次要 GC(年轻 GC)的事情正在发生。

But minor GC should be quick. Once old space is full full GC is happening (which is more time consuming).

但次要 GC 应该很快。一旦旧空间已满,就会发生 full GC(这更耗时)。

Idea is to have more frequent fast minor GCs and much less frequent full GCs.

想法是有更频繁的快速次要 GC 和更少频率的完整 GC。

You can read much more detailed explanation in this article

您可以在本文中阅读更详细的解释

回答by Nikem

I have found the following two commands very useful

我发现以下两个命令非常有用

jstat -gc

or

或者

jstat -gcutil

回答by ali haider

Might be prudent to also check for memory leaks. Use visualVM or some other tool (e.g. Eckipse memory analyzer) and attach it to the process.

也可能需要谨慎地检查内存泄漏。使用visualVM 或其他一些工具(例如Eckipse 内存分析器)并将其附加到进程中。

Once you know what is leaking, you can find what is holding references to the objects, such as

一旦你知道什么在泄漏,你就可以找到什么持有对对象的引用,例如

jmap -dump:live,file=heap.dump.out,format=b <pid>

jhat heap.dump.out

Also, just wondering, what JVM version is this, the parameters you've passed for GC etc.

另外,只是想知道,这是什么 JVM 版本,您为 GC 传递的参数等。