简体   繁体   English

Eclipse memory用完,运行缓慢

[英]Eclipse running out of memory and running slow

Although I've found similar questions, I've seem to run out of suggestions and thought of asking SO for what I've left to do.尽管我发现了类似的问题,但我似乎已经没有什么建议了,并且想问 SO 我剩下要做的事情。

I am running out of memory while using Eclipse and it starts to crawl after a couple hours to the point where I have to Force Quit.我在使用 Eclipse 时用完了 memory,几个小时后它开始爬行,以至于我不得不强制退出。 Initially it would hang and say things like "heap space out of memory."最初它会挂起并显示诸如“memory 之外的堆空间”之类的内容。 I searched on SO for things like:我在 SO 上搜索了以下内容:

Eclipse indexer hangs with 100% cpu
Eclipse running out of memory
Eclipse java heap space out of memory

So I started to incorporate all of the suggestions, with negligible improvement.因此,我开始采纳所有建议,但改进微乎其微。 Here are all of my current changes.这是我当前的所有更改。

I've been running eclipse with eclipse -debug.options so I can check memory usage我一直在运行 eclipse 和eclipse -debug.options所以我可以检查 memory 的使用情况

where the.options file has:其中.options 文件有:

org.eclipse.cdt.core/debug/pdomtimings=true
org.eclipse.cdt.core/debug/indexer=true
org.eclipse.cdt.core/debug/parser=true
org.eclipse.cdt.core/debug/deltaprocessor=true
org.eclipse.cdt.core/debug/scanner=true
org.eclipse.cdt.core/debug/model=true

I've updated my /etc/eclipse.ini file to say (was before -Xmx384m so max size is much larger now)我已经更新了我的/etc/eclipse.ini文件说(在 -Xmx384m 之前,所以现在最大尺寸要大得多)

openFile
-vmargs
-XX:MaxPermSize=256m
-Xms40m
-Xmx2048m

I've also updated the indexer options (Window -> Preferences -> C/C++ -> Indexer)我还更新了索引器选项(窗口 -> 首选项 -> C/C++ -> 索引器)

Cache limit relative to heap size: 25%
Absolute limit: 256 MB
Header file cache: 256 MB

I also unchecked Project -> Build Automatically because on any change it would momentarily hang and build the workspace我还取消选中 Project -> Build Automatically 因为在任何更改时它都会暂时挂起并构建工作区

I've also updated the history options (Window -> Preferences -> General -> Workspace -> Local History)我还更新了历史选项(Window -> Preferences -> General -> Workspace -> Local History)

Days to Keep files: 1
Maximum entries per file: 50
Maximum file size (MB): 1

Lastly, in the resource filter (Project -> Properties -> Resource -> Resource Filters) I told it to ignore indexing files and folders that match *dox最后,在资源过滤器(项目 -> 属性 -> 资源 -> 资源过滤器)中,我告诉它忽略匹配 *dox 的索引文件和文件夹

Exclude all: Name matches *dox (file and folders)

When it starts to get super slow I'll hit ctrl + \ where I ran eclipse and I'll see that its using 100% of the heap space.当它开始变得超级慢时,我将在我运行 eclipse 的地方按 ctrl + \,我会看到它使用了 100% 的堆空间。 Trying to increase the maximum size (-Xmx) beyond 2048 MB results in it complaining that it can't start the VM, but I'm wondering if this isn't exactly a case of how much space I give it.尝试将最大大小 (-Xmx) 增加到 2048 MB 以上会导致它抱怨无法启动 VM,但我想知道这是否不是我给它提供了多少空间的情况。

I keep the progress window open so I can see what it's trying to do, and usually it seems to get slower while indexing, but when it's crawling, it'll be so bad that merely scrolling seems to make it hang.我将进度 window 保持打开状态,这样我就可以看到它正在尝试做什么,通常它在索引时似乎变慢了,但是当它爬行时,它会非常糟糕,以至于仅仅滚动似乎就会让它挂起。 I usually have no choice but to close Eclipse and reopen (after about 2 hours).我通常别无选择,只能关闭 Eclipse 并重新打开(大约 2 小时后)。

What else is there left to try?还有什么可以尝试的? Is this solely a memory issue?这仅仅是一个 memory 问题吗? What else can lead me to discovering why it starts to crawl?还有什么能让我发现它开始爬行的原因?

This is on Ubuntu 12.04 and Eclipse 3.7.2 and Java OpenJDK 1.6.0_30-b30这是在 Ubuntu 12.04 和 Eclipse 3.7.2 和 Java OpenJDK 1.6.0_30-b30

After 1 month of nice CDT-Eclipse work I suddenly faced today the same problem. 经过1个月的出色CDT-Eclipse工作,今天我突然遇到了同样的问题。 I have tried to increase memory parameters, to uninstall plugins etc but fruitless. 我试图增加内存参数,卸载插件等,但是徒劳无功。 But than I found really helpful advice: 但是比我发现真正有用的建议:

"Whenever you create a new workspace for a Mozilla source tree, you should be sure to turn off the following two settings in the workspace preferences (Window > Preferences, or Eclipse > Preferences) before creating a project in that workspace: “无论何时为Mozilla源代码树创建新的工作区,在该工作区中创建项目之前,都应确保在工作区首选项(“窗口”>“首选项”或“ Eclipse”>“首选项”)中关闭以下两个设置:
- in "General > Workspace", disable "Build automatically" -在“常规>工作区”中,禁用“自动构建”
- in "C/C++ > Indexer", disable "Automatically update the index" -在“ C / C ++>索引器”中, 禁用“自动更新索引”
https://developer.mozilla.org/en-US/docs/Eclipse_CDT https://developer.mozilla.org/zh-CN/docs/Eclipse_CDT

And my problem disappeared. 我的问题消失了。

It's probably a certain add-on. 这可能是一个附加组件。 You should remove them all and try adding them back one-by-one. 您应该将它们全部删除,然后尝试将它们一一添加回去。 I've experienced this same kind of behavior with a certain code coverage plug-in, can't remember which one right now. 我已经在某种代码覆盖率的插件上经历过相同的行为,现在不记得是哪一个了。 Anyway, give that a try and see if you can pinpoint which one it is. 无论如何,请尝试一下,看看是否可以查明是哪一个。 Then you'll just have to find some alternative add-on for that one, that you can use instead. 然后,您只需要为该附件找到一些替代附件即可使用。

I've endured this issue for years.我已经忍受这个问题很多年了。 Tried every possible combination of java flags, removed plugins etc. It doesn't help.尝试了 java 标志的所有可能组合,删除了插件等。它没有帮助。 It might help for a specific project but when you get to a certain cpp file with heavy usage of macros or templates it will run out of memory.它可能对特定项目有帮助,但是当您访问某个大量使用宏或模板的 cpp 文件时,它将耗尽 memory。

You can either turn off indexing or switch to another IDE. Why?您可以关闭索引或切换到另一个 IDE。为什么? Because Eclipse CDT is ignoring this since at least 2010.因为 Eclipse CDT 至少从 2010 年开始就忽略了这一点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM