Increase memory of Eclipse Ant Runner


I am running the Eclipse ant runner from command line in the following way:

set LAUNCHER=xx\xx\org.eclipse.equinox.launcher_1.1.3.0.jar
xx\xx\java.exe -jar %LAUNCHER% -application org.eclipse.ant.core.antRunner -buildfile build.xml

I am facing OutOfMemory errors in the heap space. Adding -vmargs -Xmx512m to the command line or and changing the properties of my eclipse installation eclipse.ini file didn’t fixed the issue.

In order to be sure that the vmargs are taken into account I simply wrote the folowing task:

public class DisplayTask extends Task {
@Override
public void execute() throws BuildException {
System.out.println(Runtime.getRuntime().maxMemory() / 1000000);
}
}

and just launch it in my build.xml (using taskedf to define the task). The output is always 66 whatever I put in -vmargs -Xmx ….
After several tests I got the solution by adding -Xmx512m  only (without -vmargs) option just after the java.exe as folowing:

xx\xx\java.exe -Xmx512m -jar %LAUNCHER% -application org.eclipse.ant.core.antRunner -buildfile build.xml

Conclusion: the ant runner application doesn’t read neither the -vmargs command line options nor the eclipse.ini file options. Thus the only solution to increase memory for it is to directly pass the option to the Java virtual machine.

Advertisements

How do you handle OutOfMemoryError ??


Sometimes, depending on a lot of circumstances, Eclipse user can face the famous OutOfMemoryError. Unfortunately our users sometime face this error.

Eclipse default handling for such errors prompts the user as following:

Out Of Memory handling

Out Of Memory handling

I am asking myself: is there any more useful information we can provide to the end user in order to prevent such errors to occur again ???

May be I can parse the Error message to check if it’s a heap or permanent generation out of memory ? Thus I will be able to tell the user: add the following option when launching the product.

It also appears that sometimes this dialog is not opened, and the error is only logged in the .log file. Does it depends on the thread throwing the error …

Do you handle these errors differently than Eclipse in you custom products ? If yes, how ?

I would be interested in any comments suggestions on that topic.

Manu