This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 67473 - Ant running out of memory without setting high enough -Xmx in ANT_OPTS
Summary: Ant running out of memory without setting high enough -Xmx in ANT_OPTS
Status: RESOLVED INVALID
Alias: None
Product: projects
Classification: Unclassified
Component: Ant (show other bugs)
Version: 5.x
Hardware: All All
: P3 blocker with 1 vote (vote)
Assignee: Jesse Glick
URL:
Keywords: PERFORMANCE
Depends on:
Blocks:
 
Reported: 2005-10-25 09:19 UTC by Antonin Nebuzelsky
Modified: 2005-11-15 19:01 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Antonin Nebuzelsky 2005-10-25 09:19:31 UTC
Some users are complaining that they run into OutOfMemoryError when building in
Netbeans. This can be resolved (I hope) with setting ANT_OPTS=-XmxSOMETHING,
where SOMETHING is high enough number of megabytes, e.g. 256m.

Maybe it would make sense to set something like ANT_OPTS=256m in launcher. I am
just afraid that setting it high by default might cause problems to users with
not enough RAM. :(

What do you think about it, Jesse?
Comment 1 Jesse Glick 2005-10-25 22:45:42 UTC
Ant runs in-VM; ANT_OPTS is for the command-line. The heap is that provided to
the IDE. I think it's up to JRE ergonomics to set an appropriate default heap size.
Comment 2 Unknown 2005-11-14 20:30:10 UTC
I'm running on Debian Sarge
JDK 1.5.0_05
NB 200511081900

And yes I'm running out of memory with a compile.
In the Addtional Compiler Options, I'm specifying -J-Xmx512m and javac
says it's an invalid option.

How do we get over this hump?
-B
Comment 3 Jesse Glick 2005-11-14 22:17:59 UTC
For OOME's that are intrinsic to Ant processing, you just need to give the IDE
itself more memory, e.g. in netbeans.conf.

For compiler-related OOME's, you can pass VM args *if* you are using an external
process for the compiler. By default, Ant runs javac in-VM. To use an external
process, either

1. Use a non-default Java Platform, in the case of a plain Java project, if that
makes sense.

2. Or, set build.compiler=extJavac in project.properties (or private.properties)
of a plain Java project, to force Ant to spawn a process for javac.

3. For freeform projects or other Ant scripts, you can set
build.compiler=extJavac somehow, or use other options available on the <javac>
task, for which see its documentation in the Apache Ant manual.

Please use nbusers@netbeans.org if you need more help.
Comment 4 Jesse Glick 2005-11-14 22:18:28 UTC
sasbeb: you will never see replies to comments on bugs unless you add yourself
to CC.
Comment 5 Unknown 2005-11-15 00:34:28 UTC
It's not real apparent how to fix this.  Is it well documented?
It's too bad there's no way to edit netbeans.conf inside of NB, then
require a restart.
I'd like to re-open it because it makes the product seem inconsistent.
Comment 6 Jesse Glick 2005-11-15 00:40:34 UTC
I don't know anything about documentation. An entry could be made on the NB Wiki
giving tips. But I think the release notes already describe how to increase your
memory settings.
Comment 7 Unknown 2005-11-15 02:15:50 UTC
Sure, I know how to increase memory settings for NetBeans in the netbeans.conf
file, but the problem is that it isn't overly obvious that you have to edit it
to get rid of the OutOfMemoryError when you compile some java projects.  I would
have thought that it would have been in the additional compiler options...
Comment 8 Unknown 2005-11-15 18:29:27 UTC
Thanks... 
That worked (modifying the netbeans.conf) 
BTW... someone pointed me to: 
>> Bryan, 
>>  
>> I experimented quite a bit (!) after you were telling the thing below. 
>> The setting of the heap meory had worked for me before and so I had to 
>> figure out what it is and I finally found it and it appears to be a bug 
>> in Netbeans: ""-J-Xmx512m" option not accepted when using default Java 
>> Platform" (http://www.netbeans.org/issues/show_bug.cgi?id=68724): 
>>  
>> "I created a new project "abc" which uses the Java Platform "JDK 1.5 
>> (Default)" for which I have set the "Additional Compiler Options" to 
>> "-J-Xmx1024m" and I get the message below when I try to compile.  
>>  
>> Created dir: C:\Dokumente und Einstellungen\holger\abc\build\classes 
>> Compiling 1 source file to C:\Dokumente und 
>> Einstellungen\holger\abc\build\classes 
>> javac: invalid flag: -J-Xmx1024m 
>>  
>> Now I created a new Java Platform "Java HotSpot(TM) Client VM 
>> 1.5.0_05-b05" (which is actually the same as the default one) and set 
>> the the project Java Platform to this one. Now I start the compile 
>> action and the compilation works fine." 
 
>> Holger 
 
Which way is more "correct"? 
Comment 9 Jesse Glick 2005-11-15 19:01:28 UTC
Either work, but you may not wish to use a non-default Java platform on your
project, as it introduces an Ant property which must be set during a headless
build - which can be an advantage in some cases but may seem overhead for some
projects. As I said, you can also use build.compiler=extJavac.