• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

OutOfMemory Exception while building using eclipse compiler

 
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am using eclipse compiler in ant & building around 8000 files.I am getting OutOfMemory Exception even though i have set the max memory to 1250mb.
The same process though javac compiler runs fine with only 550mb memory.
What other parameter do I need to set so that it compiles through eclipse compiler too.
Thanks.
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What kind of out of memory exception are you getting? There are at least three different types and only one refers to heap memory, so only if you are getting that one will increasing the heap help.

What do you mean by "using eclipse compiler in ant"? That seems backwards to me; do you mean that within Eclipse you are using Ant to do you complies? If so, you could run Ant in a separate JVM.
 
Max White
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes I am getting the one which refers to heap.But as I have already told you,I have set the maximum memory to 1250 mb.


What do you mean by "using eclipse compiler in ant"? That seems backwards to me; do you mean that within Eclipse you are using Ant to do you complies?


Regarding above query,I would again say the same.Kindly check the code below :



This is just a sample which I copied from the following link :
IBM help

For using the eclipse compiler ,I used ecj.jar.


If so, you could run Ant in a separate JVM.



Regarding above,I would say that I am setting fork attribute to true.But as I am using eclipse compiler in Ant , I am getting the following information in log


Ignoring fork setting as compiler is neither classic nor modern.



The only possible solution I can think of is setting the compiler to classic or modern so that the Ant runs in a separate JVM.

But don't know how ?
Kindly help.

Thanks for the reply.



 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What have you done to verify that the heap setting is being used? Exactly what did you do to change the heap size?
 
Max White
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually I am just setting the memorymaximumsize attribute to 1250 mb .
I was going through the Ant docs and found an interesting piece of information.
The memorymaximumsize is used only if the javac is run externally,otherwise ignored.So in my case its getting ignored as fork settings are getting ignored.
Now what to do?
Thanks.

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
set your JVM arguments in eclipse before running the ant script (go to ant file try any as provide the JVM arguments), some times eclipse is not considering the JVM arguments through ant script. I did experienced the same , passing the virtual arguments in eclipse -Xmx=512m or -Xmx=1024m, hope it will resolve your issue

 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To set the heap size for Ant, set the ANT_OPTS env var before running Ant. On Windows:

set ANT_OPTS=-Xmx1024m

By the way, Ant is run from a script (ant_home/bin/ant.bat on Windows, ant_home/bin/ant on Linux). You could even set ANT_OPTS in the script.

 
Max White
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Tirupathi , but I am not using eclipse.
Thanks Peter,I have used ANT_OPTS while running checkstyle task,but i didn't know that we can do the same for building files too.
I will try & inform about the result.
 
Max White
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Peter.
Its working now.
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

i am building jar by using ant, and getting the same exception

[ejbc] The system is out of resources.
[ejbc] Consult the following stack trace for details.
[ejbc] java.lang.OutOfMemoryError: Java heap space
[ejbc] Exec failed .. exiting

BUILD FAILED
build.xml:102: Exception while calling weblogic.ejbc. Details: Ejbc reported an error.

i have tried all the scenarios what Peter has specified. like
from command prompt set ANT_OPTS=-Xmx1024m and modified ant.bat file adding "set ANT_OPTS=-Xmx1024m" still the error is not yet resolved. i am giving patch of my build.xml file where am getting error.


<target name="aurorajar">

<ejbjar srcdir="${streamcoreclass}\aurora,${streamcoreclass}\common" descriptordir="${streamcoresrc}\aurora\${aurorapackage}\META-INF" basejarname="aurora">
<dtd publicId="-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN" location="${configbase}/ejb-jar_1_1.dtd"/>
<include name="ejb-jar.xml"/>
<support dir="${streamcoreclass}\aurora">
<include name="${aurorapackage}\"/>
</support>
<support dir="${streamcoreclass}\common">
<include name="${commonpackage}\"/>
</support>
<weblogic destdir="${build}">
<classpath refid="common.classpath"/>
<classpath refid="third.party.classpath"/>
</weblogic>
</ejbjar>
</target>

getting error at the bold text .
can you please suggest, am trying till morning.

Thanks,
Gangadhar
 
Max White
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
add the below line in ant.bat as the first line

set ANT_OPTS=-Xms512m -Xmx512m -XX:PermSize=256m -XX:MaxPermSize=256m
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First, verify that that Antis running with the new memory options.

If it is, how big is the app you are compiling?
 
Methari Gangadhar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Max,

i have specified below line in ant.bat file, even i increaed 512 to 1024 still same problem

set ANT_OPTS=-Xms512m -Xmx512m -XX:PermSize=256m -XX:MaxPermSize=256m

Hi Peter,

the ant is running at new memory values, my application is having 1060 source files.

Thanks,
Gangadhar
 
Methari Gangadhar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Thanks for your help Max and Peter,

I got resolved the problem by changing the build.xml file

<weblogic destdir="${build}" jvmargs="-Xmx128m">
<classpath refid="common.classpath"/>
<classpath refid="third.party.classpath"/>
</weblogic>

i have added just that jvmargs it solved my problem.

Thanks for your help.

Thanks,
Gangadhar
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It always helps to know which JVM is running out of heap space and giving that JVM a larger heap. Glad you are up and running.
 
reply
    Bookmark Topic Watch Topic
  • New Topic