Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » AntRunner and OutOfMemoryException
AntRunner and OutOfMemoryException [message #298479] Tue, 31 January 2006 04:12 Go to next message
Eclipse UserFriend
Hello,

I have written an Eclipse plug-in which I'am using the AntRunner to
start Ant build scripts. Unfortunately I regularly have
OutOfMemoryExceptions when I test my plug-in in a runtime workbench.
Firstly the partial trace:

org.eclipse.core.runtime.CoreException[1]: java.lang.OutOfMemoryError
at org.apache.tools.ant.Project.executeTarget(Project.java:1223 )
at org.apache.tools.ant.Project.executeTargets(Project.java:106 2)
...
Caused by: java.lang.OutOfMemoryError
--- Nested Exception ---
java.lang.OutOfMemoryError


The AntRunner code is nothing special as well. It's run by a progress
monitor dialog:

// subclass to use our plugin classloader
AntRunner runner = new AntRunner() {}; // <-- might be the cause?
runner.setBuildFileLocation(...);
// set custom properties file
runner.setPropertyFiles(...);
runner.setArguments(...);
runner.setExecutionTargets(...);
runner.run();

The Ant script among others itself defines some XDoclet tasks and runs
some doclets against the sources in the eclipse project. The required
libraries are included by the script, not by the eclipse ant extensions.
Ah, and I use the Ant <record> tag...

Is there anything I have to dispose or release after AntRunner has been
used?

Thanks Jan
Re: AntRunner and OutOfMemoryException [message #298504 is a reply to message #298479] Tue, 31 January 2006 08:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: automatic.javalobby.org

I think that the Eclipse Ant tasks run Ant in a separate VM, rather than as a thread in the current VM. I could be wrong of course, but it might be that there's memory leaking in the Ant Runner process; or that there's some kind of caching going on (e.g. xDoclet?) that's causing the memory leakage.

I'd strongly recommend running this in a new VM; then, if anything goes wrong, you don't take down the Eclipse VM in its entierity, just the Ant Runner tsak. And that way, you won't have to worry whether or not the Ant Runner (or any of the dependencies like xDoclet) is leaking.

Alex.
Re: AntRunner and OutOfMemoryException [message #298510 is a reply to message #298504] Tue, 31 January 2006 08:31 Go to previous messageGo to next message
Eclipse UserFriend
Hi Alex,

thanks for the hint, but do you know how to accomplish such a task
easily, i.e., how to force the AntRunner to run in a separate VM? I've
seen some potential candidates (e.g. AntLaunchDelegate?) but they look
quite compared to the simple API of the AntRunner class...

Jan


> I think that the Eclipse Ant tasks run Ant in a separate VM, rather than as a thread in the current VM. I could be wrong of course, but it might be that there's memory leaking in the Ant Runner process; or that there's some kind of caching going on (e.g. xDoclet?) that's causing the memory leakage.
>
> I'd strongly recommend running this in a new VM; then, if anything goes wrong, you don't take down the Eclipse VM in its entierity, just the Ant Runner tsak. And that way, you won't have to worry whether or not the Ant Runner (or any of the dependencies like xDoclet) is leaking.
>
> Alex.
Re: AntRunner and OutOfMemoryException [message #298511 is a reply to message #298504] Tue, 31 January 2006 08:37 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

I don't know if it is related to your problem, but there is a bug fixed
in eclipse 3.1.2 regarding OutOfMemory errors with ANT builds :
https://bugs.eclipse.org/bugs/show_bug.cgi?id=24448

For more information, see :
http://www.eclipse.org/eclipse/development/readme_eclipse_3. 1.2.html#I-Platform-Ant

Hope that helps,
Sébastien.
Re: AntRunner and OutOfMemoryException [message #298512 is a reply to message #298511] Tue, 31 January 2006 08:41 Go to previous messageGo to next message
Eclipse UserFriend
I found it as well, and I am reading since half an hour ;-)
Damn, it has a long long history... and btw. XDoclet seems to be the bad
guy here

Jan

> Hi,
>
> I don't know if it is related to your problem, but there is a bug fixed
> in eclipse 3.1.2 regarding OutOfMemory errors with ANT builds :
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=24448
>
> For more information, see :
> http://www.eclipse.org/eclipse/development/readme_eclipse_3. 1.2.html#I-Platform-Ant
>
>
> Hope that helps,
> Se'bastien.
Re: AntRunner and OutOfMemoryException [message #298515 is a reply to message #298511] Tue, 31 January 2006 08:50 Go to previous messageGo to next message
Eclipse UserFriend
Amazing: bug 24448 has a lifetime of over 4 years now and the list of
duplicates is long ;-)

I should change the subject of my posting: what is the relation between
the easy to use AntRunner class and the ability of eclipse to run Ant
scripts in a separate VM? I know how to run Ant scripts in a separate VM
but only manually as an eclipse user, not as a plug-in developer...

Jan

> Hi,
>
> I don't know if it is related to your problem, but there is a bug fixed
> in eclipse 3.1.2 regarding OutOfMemory errors with ANT builds :
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=24448
>
> For more information, see :
> http://www.eclipse.org/eclipse/development/readme_eclipse_3. 1.2.html#I-Platform-Ant
>
>
> Hope that helps,
> Se'bastien.
Re: AntRunner and OutOfMemoryException [message #298518 is a reply to message #298510] Tue, 31 January 2006 09:10 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: automatic.javalobby.org

Yes, there would be a lot of work in making this happen correctly in a separate VM. What you'd need to do is find out where the VM is installed, then build up the arguments (including classpath dependencies) and then either massage a build.xml or invoke with a number of classpath entries on the Java command line option.

At the end of the day, it would be a System.exec() call that would do the work, so if you can figure out what sequence of args are required to make it happen, then you could figure this out. Of course, what the AntRunner task does is to integrate all of the build dependencies and do all this work for you, so it would be a non-trivial task.

However, you could just live with rebooting Eclipse on a periodic basis. Perhaps you could change the splash image to be a 'blue screen of death' to remind you of the Good Old Days.

<img src=" http://upload.wikimedia.org/wikipedia/en/3/3b/Windows_9X_BSO D.png" width="360" height="200" alt="Blue screen of death">

That said, ergonomically speaking you should be taking a break from the computer every 15 minutes; perhaps you could use the time wisely whilst it's restarting Eclipse :-)

Alex.
Re: AntRunner and OutOfMemoryException [message #298521 is a reply to message #298518] Tue, 31 January 2006 09:30 Go to previous message
Eclipse UserFriend
It doesn't bother me since I get me a coffee every 15 minutes anyway,
but it's probably annoying for those who will use my plug-in ;-)

But as it's written on the screen of death: 'it may be possible to
continue normally' ...

Jan

> [...] you should be taking a break from the computer every 15 minutes; perhaps you could use the time wisely whilst it's restarting Eclipse :-)
>
> Alex.
Previous Topic:Eclipe + CDT + GLUT problem
Next Topic:How to config workbench though parameter?
Goto Forum:
  


Current Time: Sat Jul 05 02:51:50 EDT 2025

Powered by FUDForum. Page generated in 0.06349 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top