wood burning stoves
The moose likes Java in General and the fly likes JVM memory question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "JVM memory question" Watch "JVM memory question" New topic

JVM memory question

Phil Chuang
Ranch Hand

Joined: Feb 15, 2003
Posts: 251
Say I'm running the JVM on a windows machine - if a program uses a lot of memory, and the JVM throws the out of memory exception, does that mean that it ran out of both physical memory and virtual memory? I'm just wondering if the JVM makes that dinstinction at all, because if that's the case, then that's a huge amount of memory...
Phil Chuang
Ranch Hand

Joined: Feb 15, 2003
Posts: 251
I figured out that it can't tell the difference -
But now the question is,
is there a way to tell the JVM to take up as much memory as it needs? Ie, it's maximum memory allocation is whatever free memory windows has left?
I've tried specifying an arbitrarily huge number, but that doesn't work.
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24195

Sun's JVMs don't have a "grow without bounds" switch. They do have a "grow up to such and such a limit" switch, as you've apparently already figured out. The largest possible value for this on Windows is either about 1.8 GB or 2.8GB, depending on Windows version/patch level. It's possible to use the largest legal value regardless of the size of the memory on the machine.

[Jess in Action][AskingGoodQuestions]
Phil Chuang
Ranch Hand

Joined: Feb 15, 2003
Posts: 251
In my testing, I've been able to specify -Xmx1588M on this windows 2k box.
1588Mb works out to be 1.55Gb.
Since my total memory is 1280Mb I'm going to guess that 1588 is a W2K limit.
Consider Paul's rocket mass heater.
subject: JVM memory question
It's not a secret anymore!