Running out of heap space when loading workspaces
An internal error occurred during: "Loading repository items".
java.lang.OutOfMemoryError: Java heap space
I have already tried setting the max heap in eclipse.ini, scm.ini and scm.sh but this has not helped (-Xmx4096m). Strangely dumps produced on failure are only 1.1Gb whihc would seem to indicate that the settings are not taking effect.
Running on linux if it makes any difference. HAve also tried updating to interim fix 11, still no joy.
2 answers
The clue was that the javacores listed Xmx as being set to 512mb and this got me looking at starting the program in diffeent ways using the heap indicator built into eclipse to check the results.
The OutOfMemoryError: Java heap space you are encountering while loading workspaces typically occurs when Eclipse is not actually using the heap size you have configured. Even though you have specified -Xmx4096m, the Eclipse seems to be running on a 32-bit JVM or the JVM arguments are not being picked up at startup.
On Linux, this often occurs if Eclipse is using a different Java installation than expected. Eclipse only reads JVM options from the eclipse.ini file located next to the Eclipse executable, and the placement of the options matters. The -vm option must point explicitly to a 64-bit Java binary and must appear before -vmargs, while all memory-related options such as -Xmx must appear after -vmargs. If Eclipse is launched via a wrapper script or shortcut that references another installation, changes to the wrong eclipse.ini file will have no effect.
So in order to resolve the issue, please check if you have a 64-bit JDK or JRE installed. Once Eclipse is confirmed to be running on a 64-bit JVM and the correct eclipse.ini is being applied, the heap settings you have set will take effect, and the heap dump size should increase accordingly.
To learn more interesting details about the OutOfMemoryError: Java heap space error, You can check out this blog How to Solve OutOfMemoryError: Java heap space. This will give you more insights about this Java Heap Space error.