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

Maximum allowed for JVM

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am running an application on a Windows XP machine. The application has massive tables in memory. Though the machine has approximately 2GB, the JVM runs out of memory. (The application is started with -Xm2GB.)

Is there a restriction in JVM about maximum size of memory it can use? Or machine/OS restricts the memory size? From my investigation a XP process can acquire 2GB.

I would appreciate your help .
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There may be some limit to -Xmx based on your machine. However if you exceed the limit, you should get a clear error message, like

$ java -Xmx2G Test
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

I think that it's more likely that your program is really using 2G of memory. One simple way to verify this is to run with the -verbose:gc option, which prints out messages for you about how much memory there is, and what the garbage collector's doing. Or if you're using JDK 5+, you could use JConsole. If you really are using that much memory, you'll have to figure out where it's coming from. Maybe there's a memory leak you can plug, or maybe there's a different algorithm you can use to require less memory.
 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The XP does not allow to use 2gb memory though available. SOlaris & some Linux distributions are allowing that much of memory. In XP, as per my knowledge , only 1300 MB memory is allowed to use. So better try with some less amount of memory parameter & go on increaing gradually.
Ex -Xmx256M or -Xmx512M
 
Hey, check out my mega multi devastator cannon. It's wicked. It makes this tiny ad look weak:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic