Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to increase heap space of Eclipse

📅 2013-Sep-29 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ eclipse, error, heap space, jvm, nsight ⬩ 📚 Archive

Problem

You find that Eclipse (or NVIDIA Nsight) spends too much time on indexing your source files. Or it sometimes complains about not having enough heap space. Or it throws an error message that says:

GC overhead limit exceeded

Eclipse (or Nsight) is a java program, so it runs on your Java Virtual Machine (JVM). These symptoms typically indicate that the JVM is not having enough heap space for its objects.

Solution

When Eclipse is invoked, it passes the parameters set in its eclipse.ini file to the JVM. So, you can speed up or improve the performance of Eclipse by changing these parameters passed to the JVM.

First, find out where is the eclipse.ini file on your system. On my Ubuntu, I find that it is at /usr/lib/eclipse/eclipse.ini. For Nsight, the file is named nsight.ini and I found it at /usr/local/cuda-5.5/libnsight.

I found that the default parameters for the heap space were set as this:

-Xms40m
-Xmx256m
-XX:MaxPermSize=256m

That is, the heap begins with a size of 40MB initially and can reach a maximum of 256MB. And it can use a maximum of 256MB of space for storing objects that are permanent during runtime. These limits are ridiculously small for modern systems with 4-8GB of RAM!

I increased them to:

-Xms512m
-Xmx2048m
-XX:MaxPermSize=1024m

This starts the heap at 512MB and can increase upto 2GB and so on. I found that the heap space problems stopped after doing this.

Tried with: Eclipse 3.7.2, NVIDIA Nsight 5.5.0 and Ubuntu 12.04 LTS


© 2022 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘 @codeyarns@hachyderm.io📧