Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Assigning/allocating memory issues  RSS feed

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm trying to run a program that requires alot of memory. It's falling over after some time with out of memory issues. As a test I've been using the following to see tha maximum amount of memory that I can assign:

C:\> java -Xmx1050m

At this point it fails as it cannot reserve enough space for the object heap.

I can assign 1042m (obviously it fails as there is nothing to run - it's just a test to see max allocation details).

Anyway this is on a machine with 4 gig of ram physically installed which is the max for a win 32 machine as I understand it. Out of that I actually have about 3.25gig available and from that about 2.95gig after overheads. It's a duel core machine. I was hoping to get more like 1.5gig for the JVM rather than just about 1gig.

How much memory should the JVM heap be able to use ?

Thanks,
Ed
 
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think there are rules for the -Xmx values, like a multiple of 512 or something but I don't recall off the top of my head... and those rules might not be the same for all JVM versions.
 
Marshal
Posts: 59681
187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You will find details of the Java tool here (this page for Windows only).
 
Edward Kin
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK it's less the grammar of the allocation it's more the fact that I can only assign about a GB (1024/1042 whatever - it won't assign say 1524m which is what I am after).

Should I be able to allocate more than about a Gig of ram ?
Should I be able to allocate 1524m of ram to the JVM with my system setup ?

Thanks.
 
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I work on one project which uses -Xmx1500m and works on most setups. Some computers require lower amount.

Maximum for 32-bit Windows programs is 2GB of (virtual) memory for each process (unless /3GB switch is active and the program (JVM) supports it).

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!