简体   繁体   English

Eclipse 3.5.1使用大量内存

[英]Eclipse 3.5.1 uses lot of memory

I have migrated to Eclipse 3.5.1 and observed it is taking 560 mb when doing clean build. 我已经迁移到Eclipse 3.5.1并且观察到它在执行清洁构建时需要560 MB。 And memory is not getting collected after used. 使用后内存不会被收集。 It stays like this. 它保持这样。

Any solution to this? 对此有何解决方案?

JVM : jdk1.6.0_17 Windows XP, 2GM RAM JVM:jdk1.6.0_17 Windows XP,2GM RAM

Below is my eclipse.ini 下面是我的eclipse.ini

-showlocation
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
384m
-startup
plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519
-vm
C:/Program Files/Java/jre6/bin/client/jvm.dll
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms128m
-Xmx384m
-Xss4m
-XX:PermSize=128m
-XX:MaxPermSize=384m
-XX:CompileThreshold=5
-XX:MaxGCPauseMillis=10
-XX:MaxHeapFreeRatio=70
-XX:+UseConcMarkSweepGC
-XX:+CMSIncrementalMode
-XX:+CMSIncrementalPacing
-Dcom.sun.management.jmxremote
-Dorg.eclipse.equinox.p2.reconciler.dropins.directory=C:/jaydeep/Ericsson/eclipse_galileo/eclipse/dropins

Jaydeep. Jaydeep。

I have spent a lot of time looking at Eclipse-related memory issues particularly with Eclipse 3.2 and the infamous PermGen problem. 我花了很多时间研究与Eclipse相关的内存问题,特别是Eclipse 3.2和臭名昭着的PermGen问题。

A few things that may make a difference: 一些可能有所作为的事情:

1) Drop the amount of memory used for the initial heap size: -Xms40m instead of -Xms128m. 1)删除用于初始堆大小的内存量:-Xms40m而不是-Xms128m。 2) Don't set a minimum PermGen size: remove -XX:PermSize=128m 2)不要设置最小PermGen大小:删除-XX:PermSize = 128m

1&2 will reduce the initial amount of space you need. 1和2将减少您需要的初始空间量。

3) Don't start up the help system - loading the documentation plug-ins uses a lot of memory, which never gets eliminated. 3)不要启动帮助系统 - 加载文档插件会占用大量内存,而这些内存永远不会被淘汰。 4) Use the Preferences/General/Startup and Shutdown page to deselect plug-ins that you don't need when Eclipse starts up. 4)使用Preferences / General / Startup和Shutdown页面取消选择Eclipse启动时不需要的插件。

3&4 will keep the memory usage from growing too early. 3和4将使内存使用量过早增长。

5) If you don't need the Max PermGen and Max Heap as large as they are, consider setting them lower until/unless you have an error/crash reflecting either of these. 5)如果您不需要Max PermGen和Max Heap,请考虑将它们设置得更低,直到/除非您有错误/崩溃反映其中任何一个。 Running out of PermGen will generally crash the JVM and dump a log file in the configuration folder, while heap errors will be reported to the normal .log file. 用完PermGen通常会使JVM崩溃并将日志文件转储到配置文件夹中,而堆错误将报告给正常的.log文件。

Having addressed these, you will likely still see the Windows memory grow over time without being released, though the JVM may not use everything it has available at any given time. 解决这些问题后,您可能仍会看到Windows内存随着时间的推移而不会被释放,尽管JVM可能无法在任何给定时间使用它可用的所有内容。 The task manager shows how much the JVM has available to it, while the Java memory can usually be monitored via jconsole (distributed with the JDK) and will usually be less. 任务管理器显示JVM可用的程度,而Java内存通常可以通过jconsole(随JDK一起分发)进行监视,并且通常会更少。

Hope that helps. 希望有所帮助。

Some time back I had problems with memory usage when building a very large project. 一段时间后,我在构建一个非常大的项目时遇到内存使用问题。 I was never able to prove it definitively, but I came to the conclusion that Eclipse was using a lot of space to represent compilation warnings. 我无法明确地证明它,但我得出的结论是Eclipse使用了大量空间来表示编译警告。 Try turning off all Java compiler warnings and doing a rebuild and see if that makes any difference. 尝试关闭所有Java编译器警告并进行重建,看看是否有任何区别。

AFAIK a java virtual machine won't give up its reserved heap size once it has increased. AFAIK一个java虚拟机一旦增加就不会放弃它的保留堆大小。 I see in your parameters, your PermSize has the potential of being 384Mb and your Heap size up to 384Mb, which means your virtual machine can grow up to 768Mb -- and stay there (I'm not 100% sure if stack space gets added to that as well). 我在你的参数中看到,你的PermSize有可能是384Mb,你的堆大小高达384Mb,这意味着你的虚拟机可以增长到768Mb - 并保持在那里(我不是100%确定是否添加了堆栈空间那个)。

I'm afraid eclipse is just a monster. 我担心日食只是一个怪物。 If you need to make it lighter, maybe try and remove plugins you don't need. 如果你需要让它更轻,也许尝试删除你不需要的插件。

If you're worried about "memory leaks", you can see exactly how much space is being used by the different internal memory heaps by using "jstat". 如果你担心“内存泄漏”,你可以通过使用“jstat”确切地看到不同内部内存堆正在使用多少空间。

According to my experiments, all options of vmargs set in ini, plays only once - when creating a new workspace. 根据我的实验,在ini中设置的所有vmargs选项只能播放一次 - 创建新的工作区时。 When you want to change the options in the existing workspace, use run/debug configuration. 如果要更改现有工作空间中的选项,请使用run / debug配置。 vmargs in ini won't be read any more. ini中的vmargs将不再被阅读。

That doesn't sound like an inordinate amount of memory. 这听起来不像是过多的记忆。 How large is the project your are building? 你正在建设的项目有多大?

Also, the memory may be freed within the JVM (Ie it will be available for other Java processes) but it will not be returned to the OS until the JVM (Eclipse) shuts down. 此外,内存可以在JVM中释放(即它可用于其他Java进程),但在JVM(Eclipse)关闭之前不会返回到操作系统。

Do you know for sure that the heap isn't being garbage collected? 你知道堆没有被垃圾收集吗? Try enabling the "heap status" in the status bar (enable it in the preferences) and watch if the actual used memory ever goes down (you can click on the widget to set a reference marker). 尝试在状态栏中启用“堆状态”(在首选项中启用它)并观察实际使用的内存是否已关闭(您可以单击窗口小部件来设置参考标记)。

Eclipse in general loves to eat memory, but some plugins are more memory-hungry than others. Eclipse一般都喜欢吃内存,但有些插件比其他插件更需要内存。 If you've installed any extensions, try uninstalling them one by one to see if there's a smoking gun. 如果您已经安装了任何扩展程序,请尝试逐个卸载它们以查看是否有吸烟枪。

One of my current projects eats upwards of 1.6 GB during a build. 我目前的一个项目在构建期间吃掉了1.6 GB以上。 It's just something we've had to live with, really... 这只是我们不得不忍受的东西,真的......

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

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