2

I need to set

ANT_OPTS=-Xms1024m -Xmx6144m -XX:PermSize=1024m -XX:MaxPermSize=1024m

JAVA_OPTS=-Xms1024m -Xmx6144m -XX:PermSize=1024m -XX:MaxPermSize=1024m

I have a system with 8gb(recently upgraded from 4 gb)

But once i set the ant opts to above said value I am not able to run any of my ant targets and I get the following error

[ERROR] Argument error: -Xmx6144m
[ERROR] Specified maximum heap size (6144 MB) is larger than the address space on this platform (4 GB).
[WARN ] -XX:PermSize=1024m is not a valid VM option. Ignoring
[WARN ] -XX:MaxPermSize=1024m is not a valid VM option. Ignoring
Could not create the Java virtual machine.

This indicates the Java that I have on my system

java version "1.6.0_20"
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Oracle JRockit(R) (build R28.1.0-123-138454-1.6.0_20-20101014-1351-windows-x86_64, compiled mode)

and I am running a Windows 7 on Intel Core 2 Duo 3Ghz processor and 8GB RAM.

PS: I did Google for the error and it was one of my first such occurrences where I did not get any links pointing to the specific solution.

Qantas 94 Heavy
  • 15,750
  • 31
  • 68
  • 83
Arun
  • 311
  • 3
  • 7
  • 15
  • Wrong place to ask. But have a look at http://stackoverflow.com/questions/3030263/increasing-the-jvm-maximum-heap-size-for-memory-intensive-applications – Matten Apr 11 '12 at 11:59
  • Can you suggest me the appropriate place to post this ?? – Arun Apr 11 '12 at 12:05
  • 1
    superuser.com or serverfault.com – Matten Apr 11 '12 at 12:14
  • What's the largest heapsize `-Xmx` that does work? – beny23 Apr 11 '12 at 13:27
  • 1
    Im thinking you just ran java -version to display the Rocket version? If so that doesn't mean its the same JVM ANT is using. Run %JAVA_HOME%\bin\java -version or change the ant batch file to spit out the version. – Andrew T Finnell Apr 11 '12 at 13:35
  • @AndrewFinnell When i ran the command u specified i got this **java version "1.6.0_05" Java(TM) SE Runtime Environment (build 1.6.0_05-b13) BEA JRockit(R) (build R27.6.0-50_o-100423-1.6.0_05-20080626-2105-windows-ia32, compiled mode)** Does this mean i have a 32 bit JVM? I was quite sure until now that its a 64bit version, because when I use this `System.getProperty("sun.arch.data.model")` i see 64 as output in the console – Arun Apr 12 '12 at 03:45
  • 1
    It means you have BOTH but your JAVA HOME is pointing to the 32 bit version. Update the environmental variable to point to the 64 bit version or hard code the path in the ant batch file – Andrew T Finnell Apr 12 '12 at 10:58
  • @AndrewFinnell, Thanks a lot !! It was indeed as you said. I got my Jrockit re-installed and pointed my JAVA_HOME to this new version. It works great now!! – Arun Apr 13 '12 at 04:03
  • @Arun I'll create an Answer out of our comments, if you wouldn't mind marking it as the answer so others can search and find this when presented with a similar problem. – Andrew T Finnell Apr 13 '12 at 10:12

2 Answers2

3

As discussed in the comments:

It would seem that your ANT installation is using a 32-bit JVM. While a 64-bi JVM is in your PATH ANT doesn't obey the JVM in your PATH, it first looks at JAVA_HOME. You can verify this by running $JAVA_HOME/bin/java -version.

You can update your environment to set JAVA_HOME to the 64-bit version or change the ANT script to always use a specific version of Java.

Andrew T Finnell
  • 13,417
  • 3
  • 33
  • 49
2

The error message appears to be suggesting the platform is 32-bit. I imagine you can't actually use 4 GB.

I would try installing the 64-bit version of Java and using that.


For the HotSpot JVM I would expect to see

$ java -mx30g -version
java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b05)
Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode)
Peter Lawrey
  • 525,659
  • 79
  • 751
  • 1,130