Eclipse will throw the below error when it runs out of memory. It normally occurs on big projects when performing memory-intensive operations, such as building workspace.
An internal error occurred during: "Building workspace". GC overhead limit exceeded
Memory is allocated via
Eclipse' configuration file which is executed during
Eclipse' startup. It is located in its installation directory and named
eclipse.ini. The default values are good enough for small projects, but not suffice for the bigger ones.
Below is the file's content for Eclipse Neon;
-startup plugins/org.eclipse.equinox.launcher_1.3.200.v20160318-1642.jar --launcher.library plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.400.v20160518-1444 -product org.eclipse.epp.package.java.product --launcher.defaultAction openFile -showsplash org.eclipse.platform --launcher.defaultAction openFile --launcher.appendVmargs -vmargs -Dosgi.requiredJavaVersion=1.8 -XX:+UseG1GC -XX:+UseStringDeduplication -Dosgi.requiredJavaVersion=1.8 -Xms256m -Xmx1024m
Fixing the problem means allocating more memory for
Eclipse. This is done by increasing the values of some parameters in the configuration file. You should only be concerned of the following lines;
Each lines allocate memory in
Megabytes for different aspect of the program, namely the followings;
There's no one-size-fits-all solution for this issue as it depends on how much memory you need versus how much memory you have. You can start by probably doubling the amounts as in the below example and then go from there.
The changes will take effect after
Eclipse is restarted.