• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using -Xmx option with java

 
sayali s kulkarni
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have 8GB memory and I am trying to allocate 4GB to one of the java processes as;
java -Xmx4000m testpck.testPrg
But this seems to give the following error:
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

I have double checked my RAM size and it is 8GB with 16G swap space. What could I be possibly missing? Is there some other setting in jvm options I need to specify?

Thanks in advance for the help.

--sayali
 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It depends on the operating systems and the JVM you're using. Here are some hints: http://stackoverflow.com/questions/171205/java-maximum-memory-on-windows-xp
 
sayali s kulkarni
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the tip Lester.

My current OS is Linux (64-bit). When I tried searching a bit more on this, http://www.coderanch.com/t/504688/java/java/Mamimum-Value-which-allowed-XMX#2277538 references a similar issue but seems that some are able to 8GB on a 64-bit linux.

Could someone please let me know if there are any other specific JVM/system configs that I need to look for?

Thanks in advance once again,
--sayali
 
Henry Wong
author
Marshal
Pie
Posts: 21420
84
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sayali s kulkarni wrote:
Could someone please let me know if there are any other specific JVM/system configs that I need to look for?


The most obvious thing to check is... did you install the 64 bit Java ?

Henry
 
sayali s kulkarni
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mine is 32-bit java.
$java -d64 -version
This Java instance does not support a 64-bit JVM.

Might this be the issue? If yes, the max memory that I can get with 32-bit version is just 2.5G even when my RAM is 8gig?
 
Henry Wong
author
Marshal
Pie
Posts: 21420
84
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sayali s kulkarni wrote:
If yes, the max memory that I can get with 32-bit version is just 2.5G even when my RAM is 8gig?


How much memory available to the JVM depends on it works with the OS. With a 32 bit JVM, the theoretical maximum is 4 gig -- with most 32 bit JVMs, it is around 2 gig. You are actually lucky with 2.5 gig. I seen it as low as less than 1.5 gig.

Why don't you install a 64 bit JVM? This way, you can use a lot more memory -- well, until the GC starts to choke...

Henry
 
sayali s kulkarni
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot for the tips Henry. Will try with a 64-bit JVM.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic