30

When I try to use any javascript template Eclipse always hangs and I get this message: "Unhandled event loop exception Java heap space" on a popup.

I started a top command (using Ubuntu) for the Eclipse process and for Java process and then tried to use an auto-complete on Eclipse. I notice that the Java process takes my CPU to 100% while memory stays the same(arround 22%).

I got this without any prior changes to my Eclipse IDE...

Any ideas on how to solve this?

EDIT: I notice also that on the preferences window under: Javascript / Content Assist / Advanced the option "Other Javascript Proposals" is checked. When unchecked, the problem is solved. However, it lacks the content assist for variables and objects. So this partially solves my problem.

Kellindil
  • 4,523
  • 21
  • 20
ramaralo
  • 1,013
  • 2
  • 10
  • 15

5 Answers5

40

This error is a 'classic' for any Eclipse user. Open the folder in which you have your eclipse. There, edit the "eclipse.ini" file.

Locate the line on which there is "-vm". Under this line, you have three generic settings for the memory. In short :

  • "Xms" is the minimal amount of memory allocated to the virtual machine.
  • "Xmx" is the maximal amount.
  • "MaxPermSize" is the amount of memory allocated to the permgen of the virtual machine.

The exception with the error message you have here means that java has reached its maximum memory setting, yet it needs more. Java taking 100% of the CPU in such cases is "normal" : the garbage collector is working full time. The one setting you want to edit is "Xmx" which will give a little more memory for Java to breathe, but it does not hurt to set the other two a little higher too. My usual settings are :

  • -Xms256m
  • -Xmx1024m
  • -XX:MaxPermSize=256m
Kellindil
  • 4,523
  • 21
  • 20
  • Thank you. However I managed to find the problem. I temporarily moved some js files to my project (some of them duplicated the original ones) and auto-complete was searching in too many files. So I changed the src folder like this: – ramaralo Jan 14 '13 at 15:44
  • Thank you. However I managed to find the problem. I temporarily moved some js files to my project (some of them duplicated the original ones) and auto-complete was searching in too many files. So I changed the src folder like this: - Right click on project - Choose properties - Javascript - Include path - On the source tab I excluded the files/folders that were duplicated and some that I didn't want to use on auto-complete. This solved my problem and my Eclipse is fast now on auto-complete. – ramaralo Jan 14 '13 at 15:54
  • How do do this on OS X: https://wiki.eclipse.org/Eclipse.ini#-vm_value:_Mac_OS_X_Example – NobleUplift May 18 '15 at 21:54
5

I managed to find the problem. I temporarily moved some js files to my project (some of them duplicated the original ones) and auto-complete was searching in too many files. So I changed the src folder like this:

  • Right click on project
  • Choose properties
  • Javascript
  • Include path
  • On the source tab I excluded the files/folders that were duplicated and some that I didn't want to use on auto-complete.

This solved my problem and my Eclipse is fast now on auto-complete.

ramaralo
  • 1,013
  • 2
  • 10
  • 15
  • +1, basically you want to exclude everything you don't really need Eclipse to parse every single time you do code completion. Code completion for most libraries [doesn't work](http://stackoverflow.com/questions/11309953/) in Eclipse anyway because it doesn't understand the structure, so it will just be a waste of time and resources. – Redsandro Jun 19 '13 at 14:44
1

(1) Go to the open lunch configuration then go to the arguments add this

     -Xms512m
    -Xmx1024m
-XX:MaxPermSize=512m
user3062776
  • 157
  • 10
0

you can change add below commands to AIDE.ini file and restart the IDE.

-vmargs
-Dosgi.requiredJavaVersion=1.6
-Dlocaldev=true
-Xms256m
-Xmx512m
-XX:PermSize=128m
-XX:MaxPermSize=256m
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 
0

after working several hours in my case I found the solution I hope it works for you ; change my JDK to alternate JRE

enter image description here

Suraj Rao
  • 29,388
  • 11
  • 94
  • 103
Omer CANGA
  • 31
  • 2