• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Using -Xmx option with java

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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, https://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
 
author
Posts: 23958
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 23958
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot for the tips Henry. Will try with a 64-bit JVM.
 
A tiny monkey bit me and I got tiny ads:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic