my dog learned polymorphism*
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 Android Security Essentials Live Lessons this week in the Android 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: 24183

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.
jQuery in Action, 2nd edition
subject: JVM memory question
Similar Threads
Available Ram...
memory allocation
Criteria.list() hanging after a few runs
Problem with fetching Web pages