Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Assigning/allocating memory issues

 
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
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: 69889
278
  • 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).

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic