This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Performance and the fly likes Maximum allowed for JVM Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Performance
Reply Bookmark "Maximum allowed for JVM" Watch "Maximum allowed for JVM" New topic
Author

Maximum allowed for JVM

Sushil Sharma
Greenhorn

Joined: Nov 02, 2006
Posts: 22
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 .
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18670
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.


"I'm not back." - Bill Harding, Twister
prasad kulkarni
Ranch Hand

Joined: Mar 19, 2006
Posts: 66
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


scjp, scwcd
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Maximum allowed for JVM
 
Similar Threads
Hibernate DB2
JVM Max Heap Size recommended
32 bit JVM memory heap issue on 64 bit XP
increasing heap size in jboss
JVM memory allocation