OK. Intel Mac, Core-2 Duo (64bit processor). OS X 10.5.x
Java 1.5 (32-bit)
The maximum seems to be somewhere between 2100 MB and 2200 MB.
Didn’t pin it down any closer than that.
Java 1.6 (64-bit)
No really noticeable limit. I tried 4,000,000 MB as max and it was
fine. Trying something similarly big as the minimum size, I decided
to kill the job since it was taking a while to allocate. Plus I don’t
actually have that much disk space on this machine.
Testing with OS X 10.4 and also PPC would be good as well.
Actually I can take a guess why its weird. Although I have 4GB of ram my
boot up only indicates there is only 3.5 suggesting I have a bad chip or
block of memory in one of the RAM sticks and it hit that sector perhaps?
AGP aperture? Or whatever super-fast-son-of-PCI-with-a-funny-connector
it is this week, I presume it still needs a hole in the memory map to
stick the graphics card in…
Thanks everyone for trying this. Your prompt replies made it possible
for me to craft what I think is a solution to the problem, and quite
possibly one of the weirdest pieces of code I’ve ever written. (Check
out VASSAL.tools.HeapFinder and VASSAL.tools.HeapFinderDummy if you
don’t believe me.)
If you’re on a 32-bit system and set a maximum heap size in the
Preferences for a module to something too large for your JVM, then the
next time you open that module, the Module Manager will try t
determine a more appropriate maximum heap size (in this case, 75% of
the maximum maximum heap size) and run the module with that instead.
If that happens, you’ll get a warning dialog which will remind you to
adjust your maximum heap size (once I’ve written the warning message).
Does anyone know if it’s possible to determine from within Java how
much physical RAM the host machine has? This exercise got me thinking
about a heuristic for determining optimal heap settings for the user
(so that the user only has to mess with heap settings in the event that
he doesn’t like the ones the heursitic gives him).
This doesn’t seem possible outside of Runtime.exec() followed by Process.getOutputStream(). The JVM appears to know only about how much memory has been allocated. However, if you’re only worried about Win32, this may not be so bad.
Follow-up: You can read the path to the JRE installation from the
“java.home” system property, and “java.home” + “/bin/java” is the
path to the JVM in use.
I did some looking around, but couldn’t really find anything that
seemed all that similar.
Otherwise, I’m not sure how you would get that information short of
using some type of Mac-specific system calls.
There is vm_stat but that just shows virtual memory: