Solve the problem of eclipse saving stuck

If eclipse starts slowly, it can also receive. However, if it freezes when saving, sometimes it will freeze for 3 seconds to 5 seconds, and it feels that writing code is particularly unsmooth. How to play?

My eclipse is stuck when saving. In fact, the project is not big, it is just a lot of files and a lot of directory structure.

Another project, using eclipse, does not need to configure anything, and it is not stuck at all when saving.

You can refer to the solutions of netizens on the Internet

http://baijiahao.baidu.com/s?id=1563222228113375&wfr=spider&for=pc

But I have tried it, and it can improve the speed of eclipse startup and compilation at most, but the saving will still be stuck.

Many programs say that you only need to configure -Xms and -Xmx in eclipse.ini. I configured it but found that it still doesn't work.

-Xms512m
-Xmx2048m

solution

Just read "In-depth understanding of JAVA virtual machine", there is an example in the tuning eclipse card problem.

Added -XX:MaxPermSize and found that this problem was solved. If it was not added, it would be stuck. The book says that the default MaxPermSize is too small or the eclipse does not know MaxPermSize, just ignore it and add it.

非堆内存分配


 JVM使用-XX:PermSize设置非堆内存初始值,默认是物理内存的1/64;由XX:MaxPermSize设置最大非堆内存的大小,默认是物理内存的1/4。(还有一说:MaxPermSize缺省值和-server -client选项相关,
 -server选项下默认MaxPermSize为64m,-client选项下默认MaxPermSize为32m。这个我没有实验。)
 上面错误信息中的PermGen space的全称是Permanent Generation space,是指内存的永久保存区域。还没有弄明白PermGen space是属于非堆内存,还是就是非堆内存,但至少是属于了。
XX:MaxPermSize设置过小会导致java.lang.OutOfMemoryError: PermGen space 就是内存益出。 
说说为什么会内存益出: 
(1)这一部分内存用于存放Class和Meta的信息,Class在被 Load的时候被放入PermGen space区域,它和存放Instance的Heap区域不同。 
(2)GC(Garbage Collection)不会在主程序运行期对PermGen space进行清理,所以如果你的APP会LOAD很多CLASS 的话,就很可能出现PermGen space错误。
  这种错误常见在web服务器对JSP进行pre compile的时候。
设置永久代最大容量
-XX:MaxPermSize=768M

The following is my eclipse.ini configuration file, everyone try to use the new version of jdk and eclipse

-startup
plugins/org.eclipse.equinox.launcher_1.4.0.v20161219-1356.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.500.v20170531-1133
-product
org.eclipse.epp.package.jee.product
-showsplash
org.eclipse.epp.package.common
--launcher.defaultAction
openFile
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=1.8
[email protected]/eclipse-workspace
-XX:+UseG1GC
-XX:+UseStringDeduplication
-Dosgi.requiredJavaVersion=1.8
-Xms512m
-Xmx2048m
-XX:MaxPermSize=768M

or as above

-Xms2048m
-Xmx2048m
-XX:PermSize=1024M
-XX:MaxPermSize=1024M
-Xverify:none

由上述分析可以得出结论: Eclipse启动时,
Full GC大多数是由于老年代容量扩展而导致的,
由永久代空间扩展而导致的也有一部分。 为了避
免这些扩展所带来的性能浪费, 我们可以把-Xms
和-XX: PermSize参数值设置为-Xmx和-XX:
MaxPermSize参数值一样, 这样就强制虚拟机在
启动的时候就把老年代和永久代的容量固定下
来, 避免运行时自动扩展。

Eclipse使用者甚多, 它的
编译代码我们可以认为是可靠的, 不需要在加载
的时候再进行字节码验证, 因此通过参数-
Xverify: none禁止掉字节码验证过程也可作为一
项优化措施。 加

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325521003&siteId=291194637