File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes JVM memory allocation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "JVM memory allocation" Watch "JVM memory allocation" New topic

JVM memory allocation

satyendra adhikari
Ranch Hand

Joined: Aug 17, 2001
Posts: 52
Is it possible to specify max memory for a JVM more that the available system memory.

Say, I have a machine with 1 GB RAM and I want to run a JVM with max memory setting set to 2GB .
Will it work for an application that needs 2GB memory, any explanation or more information will be much appreciated.

Thank you!!
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

If your system supports virtual memory, then theoretically you could do that. You might find your application runs slowly or erratically because of the paging involved, though.
satyendra adhikari
Ranch Hand

Joined: Aug 17, 2001
Posts: 52
Ok, thanks!

so what happens is OS dependent, if the OS can not allow it additional memory (by working around virtual memory in such cases), will it throw out of memory error?
Chandramouli Jambunathan

Joined: Mar 17, 2009
Posts: 8

Increase JVM heap size to avoid Out of memory problem..
I agree. Here's the link:
subject: JVM memory allocation
It's not a secret anymore!