Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

eclipse dies every few minutes with latest jdk saying 'out of space in CodeCache for adapters'

Tags:

java

eclipse

Since I installed latest jdk (1.6.0_25) I am having a very annoying issue that constantly makes my eclipse restart. This happens while doing any action, not a big clean project or anything.

My environment is the following:

win7, 64b

eclipse Version: 3.6.2 (64b) Build id: M20110210-1200

java version "1.6.0_25" Java(TM) SE Runtime Environment (build 1.6.0_25-b06) Java HotSpot(TM) 64-Bit Server VM (build 20.0-b11, mixed mode)

Before I had a previous jdk version (not sure what number, but was 1.6.0_21 or so, also 64b).

Since I installed 1.6.0_25 my eclipse dies every few minutes. I get a dialog in the UI saying:

Problems occurred while trying to save the state of the workbench. Internal Error out of space in CodeCache for adapters

And the log shows:

!SESSION Fri May 13 12:35:53 CEST 2011 ----------------------------------------- !ENTRY org.eclipse.equinox.launcher 4 0 2011-05-13 12:35:53.870 !MESSAGE Exception launching the Eclipse Platform: !STACK java.lang.VerifyError: (class: org/eclipse/osgi/framework/log/FrameworkLogEntry, method: getThrowable signature: ()Ljava/lang/Throwable;) Illegal constant pool index at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:200) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:620) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575) at org.eclipse.equinox.launcher.Main.run(Main.java:1408)

My eclipse.ini files has this:

-showlocation
-showsplash org.eclipse.platform
--launcher.defaultAction openFile
-vm c:/jdk1.6.0/jre/bin/server/jvm.dll
-vmargs
-Dosgi.requiredJavaVersion=1.6
-Declipse.p2.unsignedPolicy=allow
-Djava.library.path=d:\dev\SlikSvn\bin
-Xms256m
-Xmx768m
-Xss4m
-XX:PermSize=256m
-XX:MaxPermSize=512M
-XX:CompileThreshold=5
-XX:MaxGCPauseMillis=10
-XX:MaxHeapFreeRatio=70
-XX:+CMSIncrementalPacing
-XX:+UnlockExperimentalVMOptions
-XX:+UseG1GC
-XX:+UseFastAccessorMethods
-Dcom.sun.management.jmxremote

anyone has an idea how to solve this?

like image 273
Persimmonium Avatar asked May 16 '11 10:05

Persimmonium


2 Answers

Here's a posting from someone who has a possible workaround for the problem: http://www.apacheserver.net/trunk-build-problem-out-of-space-in-CodeCache-for-adapters-at1027069.htm

The suggested workaround is to add -XX:ReservedCodeCacheSize=64m to the JVM options. If that doesn't help, try a bigger number.

(I believe that the code cache is allocated within permgen, so increasing the permgen heap size might help as well. However, various hints in Oracle bug reports suggest that these problems are caused by fragmentation of the code cache, and that would suggest that preallocation is a sensible strategy. But really I'm only guessing.)

like image 89
Stephen C Avatar answered Nov 07 '22 11:11

Stephen C


I had the same problem. Increasing the code cache size is a good idea but I added

-XX:+UseCodeCacheFlushing

to the JAVA options for the JVM startup and this fixed the problem too. I know this StackOverflow issue is old, but I hope is saves another user some time.

like image 28
Mr.Mountain Avatar answered Nov 07 '22 12:11

Mr.Mountain