• 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
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Assigning/allocating memory issues

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 76419
365
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).

 
Brace yourself while corporate america tries to sell us its things. Some day they will chill and use tiny ads.
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic