You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Weiqi Gao <we...@networkusa.net> on 2000/09/16 01:43:59 UTC

Javac task running out of memory

Hi,

We have a fairly large Java source tree (500+ *.java files in a dozen
packages/subpackages) which we would like to use Ant to build.

Our first try of the obvious solution:

<project name="foo" default="compile">
  <target name="compile">
    <javac srcdir="./src" destdir="./classes" />
  </target>
</project>

caused Ant to report "compiling 539 java files", and then after a minute
of two, the build fails with an OutOfMemoryError.  We think javac simply
has too many files to compile.

Has this problem come up before?  Is there a good solution to this
problem (other than the obvious hacks: split the project into two,
increase the maximum memory size for javac)?

-- 
Weiqi Gao
weiqigao@networkusa.net

Re: Javac task running out of memory

Posted by Ken Wood <kw...@i2.com>.
This is the correct solution, because I define JAVACMD with
more than the default parameters set, and I build a project
with 2137 java source files with no problem.

Note that the parameters David gave are for JDK 1.1
JDK 1.2 uses -Xms128m -Xmx128m

David Bullock wrote:

> Hi. See below.
>
> Peter Donald wrote:
>
>> At 06:43  15/9/00 -0500, you wrote:
>> >Hi,
>> >
>> >We have a fairly large Java source tree (500+ *.java files in a dozen
>> >packages/subpackages) which we would like to use Ant to build.
>> >
>
> You could also not fork, and just give more memory to the JVM running Ant.  Use the -ms and
> -mx flags to the 'java' command in the ant script file, or set the $JAVACMD environment
> variable that that script uses, in your .antrc, to
>
>   setenv JAVACMD "/my/path/to/java -ms128 -mx128"
>
> --
> David Bullock
> Project Leader
> dbullock@lisa.com.au
>
> "It's no use saying 'We are doing our best.'  You
> have got to succeed in doing what's necessary."
>     ...Winston Churchill
>
>
> LISAsoft
> http://www.lisa.com.au/
>
> Adelaide                  Sydney
> --------------------      ------------------------
> 38 Greenhill Rd           Level 3, 228 Pitt Street
> Wayville S.A. 5034        Sydney NSW 2000
> Australia                 Australia
>
> PH  +61 8 8272 1555       PH  +61 2 9283 0877
> FAX +61 8 8271 1199       FAX +61 2 9283 0866
> --------------------      ------------------------
>
>

Re: Javac task running out of memory

Posted by David Bullock <db...@ardec.com.au>.
Hi. See below.

Peter Donald wrote:

> At 06:43  15/9/00 -0500, you wrote:
> >Hi,
> >
> >We have a fairly large Java source tree (500+ *.java files in a dozen
> >packages/subpackages) which we would like to use Ant to build.
> >
> >
> > after a minute
> >of two, the build fails with an OutOfMemoryError.  We think javac simply
> >has too many files to compile.
> >
> >Has this problem come up before?  Is there a good solution to this
> >problem (other than the obvious hacks: split the project into two,
> >increase the maximum memory size for javac)?
>
> well I use jikes to compile projects with about 1400 files - so that would
> definetly be an option :P. Otherwise you are left with splitting up the
> build :( or perhaps you could make java task launch a new process and pass
> flags to alow the JVM to use more memory

You could also not fork, and just give more memory to the JVM running Ant.
Use the -ms and -mx flags to the 'java' command in the ant script file, or
set the $JAVACMD environment variable that that script uses, in your .antrc,
to

  setenv JAVACMD "/my/path/to/java -ms128 -mx128"

--
David Bullock
Project Leader
dbullock@lisa.com.au

"It's no use saying 'We are doing our best.'  You
have got to succeed in doing what's necessary."
    ...Winston Churchill

LISAsoft
http://www.lisa.com.au/

Adelaide                  Sydney
--------------------      ------------------------
38 Greenhill Rd           Level 3, 228 Pitt Street
Wayville S.A. 5034        Sydney NSW 2000
Australia                 Australia

PH  +61 8 8272 1555       PH  +61 2 9283 0877
FAX +61 8 8271 1199       FAX +61 2 9283 0866
--------------------      ------------------------



Re: Javac task running out of memory

Posted by Peter Donald <do...@mad.scientist.com>.
At 06:43  15/9/00 -0500, you wrote:
>Hi,
>
>We have a fairly large Java source tree (500+ *.java files in a dozen
>packages/subpackages) which we would like to use Ant to build.
>
>Our first try of the obvious solution:
>
><project name="foo" default="compile">
>  <target name="compile">
>    <javac srcdir="./src" destdir="./classes" />
>  </target>
></project>
>
>caused Ant to report "compiling 539 java files", and then after a minute
>of two, the build fails with an OutOfMemoryError.  We think javac simply
>has too many files to compile.
>
>Has this problem come up before?  Is there a good solution to this
>problem (other than the obvious hacks: split the project into two,
>increase the maximum memory size for javac)?

well I use jikes to compile projects with about 1400 files - so that would
definetly be an option :P. Otherwise you are left with splitting up the
build :( or perhaps you could make java task launch a new process and pass
flags to alow the JVM to use more memory

Cheers,

Pete

*------------------------------------------------------*
| "Nearly all men can stand adversity, but if you want |
| to test a man's character, give him power."          |
|       -Abraham Lincoln                               |
*------------------------------------------------------*