Eclipse 随机使用 100% CPU
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2681989/
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
Eclipse uses 100 % CPU randomly
提问by Florian Gutmann
My eclipse sometimes starts using 100 % of my CPU very spontaneously. I can't figure out why it needs that much CPU usage. There is no background task like "building workspace" running.
我的日食有时会非常自发地开始使用 100% 的 CPU。我不明白为什么它需要那么多 CPU 使用率。没有像“构建工作区”这样的后台任务在运行。
After some time the CPU load drops to 0 and everything is normal.
一段时间后,CPU 负载降至 0,一切正常。
I can't find any information related to the problem in workspace/.metadata/.log
file.
我在workspace/.metadata/.log
文件中找不到与问题相关的任何信息。
Has anybody some tip how I can figure out which part of eclipse is using the CPU so heavily? Is there a way to get a thread dump of eclipse? The kill -3
on the eclipse process doesn't do anything.
有没有人告诉我如何确定 eclipse 的哪一部分如此大量地使用 CPU?有没有办法获得eclipse的线程转储?在kill -3
Eclipse的过程中没有做任何事情。
Eclipse Version: Galileo JavaEE
Operating System: Linux 2.6.31
Eclipse 版本:Galileo JavaEE
操作系统:Linux 2.6.31
采纳答案by Stephen Denne
You can use visualvm to profile eclipse, get a heap dump or a thread dump, see which threads are running, etc.
您可以使用 visualvm 来分析 eclipse、获取堆转储或线程转储、查看哪些线程正在运行等。
回答by stacker
Sounds like garbage collection
听起来像垃圾收集
You could try changing the settings in your eclipse.ini, maybe with a higher Xmx value
您可以尝试更改 eclipse.ini 中的设置,也许使用更高的 Xmx 值
--launcher.XXMaxPermSize
256m
-vmargs
-Xms256m
-Xmx1024m
-XX:PermSize=64m
-Xss1M
-server
-XX:+DoEscapeAnalysis
-XX:+UseConcMarkSweepGC
回答by daboross
If anyone else is having this problem, I fixed it for myself. Set the option "auto build project" to off. That should remove a lot of the CPU used by Eclipse.
如果其他人遇到这个问题,我自己解决了。将选项“自动构建项目”设置为关闭。这应该会删除 Eclipse 使用的大量 CPU。
回答by tuckerpm
For my installation, I noticed the heap status indicator (Enabled VIA Window>Preferences "Show heap status" under General) was displaying less max heap than allocated in eclipse.ini (the -Xmx setting). The status indicator was bouncing around indicating that garbage collection was struggling to keep memory low.
对于我的安装,我注意到堆状态指示器(在常规下启用 VIA 窗口>首选项“显示堆状态”)显示的最大堆比在 eclipse.ini(-Xmx 设置)中分配的少。状态指示器一直在跳动,表明垃圾收集正在努力保持低内存。
Increasing the initial/min heap size (the -Xms setting) seems to have caused Eclipse/Java to stop trying to manage memory as much.
增加初始/最小堆大小(-Xms 设置)似乎已导致 Eclipse/Java 停止尝试尽可能多地管理内存。
回答by theo231022
Eclipse is loading and unloading information from memory whenever this is required. If you workspace is big and you work with multiple projects and also your eclipse is configured to use low ammount of memory this is normal. Someone suggested above to change the xmx and xms values so that your eclipse uses more memory (if you have available) I suggest u put the same value to both of them. For example -Xms4048m and -Xmx4048m (or more) in your eclipse.ini file. This way your system will attempt to make use of that space once you start your IDE and the Garbage Collector (GC) takes less time to process data.
Eclipse 会在需要时从内存加载和卸载信息。如果您的工作区很大并且您处理多个项目,并且您的 Eclipse 配置为使用低内存量,这是正常的。上面有人建议更改 xmx 和 xms 值,以便您的日食使用更多内存(如果您有可用的内存)我建议您为它们设置相同的值。例如,eclipse.ini 文件中的 -Xms4048m 和 -Xmx4048m(或更多)。这样,您的系统将在您启动 IDE 后尝试利用该空间,并且垃圾收集器 (GC) 处理数据所需的时间更少。