Shervin Asgari
Shervin Asgari

Reputation: 24499

Out of memory error in ant

I am trying to run ant task, however I get the following error:

[javadoc] javadoc: error - java.lang.OutOfMemoryError: Please increase memory.
[javadoc] For example, on the Sun Classic or HotSpot VMs, add the option -J-Xmx
[javadoc] such as -J-Xmx32m.
[javadoc] 1 error
[javadoc] 103 warnings

I have tried googling to find out how I can set this value, but I cannot find it. I have tried

<javadoc maxmemory="256m">

I have tried

export ANT_OPTS=-Xmx256m

but I still get the same exception. I have tried to increase the value to 1024m witouth any success

Update

I solved it. It had nothing to do with little memory. It was an endeless loop in my javadoc generation.

Upvotes: 8

Views: 34630

Answers (2)

Shervin Asgari
Shervin Asgari

Reputation: 24499

I solved it.

It had nothing to do with little memory. It was an endeless loop in my javadoc generation.

The correct way of setting more memory for ant is by using export ANT_OPTS=-Xmx256m on *nix.

On Windows follow the usual steps for setting environment variables.

Upvotes: 13

Mike Yockey
Mike Yockey

Reputation: 4593

The javac ant task has the attribute memoryMaximumSize which you should set to the same value as you would for -Xmx.

<javac memoryMaximumSize="256m" ...>
  ...
</javac>

I should add that this assumes that it is indeed a javac task that's causing the memory overrun.

Upvotes: 6

Related Questions