these are bug reports from users out in the field. it appears most of them are running windows xp. here are the machine stats from three of the "OutOfMemoryError" bug reports, selected at random:
Adapter: nv4_disp
DriverVersion: 6.14.10.6085
DisplayVendor: NVIDIA Corporation
DisplayRenderer: GeForce4 MX 4000/AGP/SSE/3DNOW!
DisplayAPIVersion: 1.5.1
java.version: 1.6.0_01
os.name: Windows XP
os.arch: x86
Adapter: ialmrnt5
DriverVersion: 6.14.10.4363
DisplayVendor: Intel
DisplayRenderer: Intel 915G
DisplayAPIVersion: 1.4.0 - Build 4.14.10.4363
java.version: 1.6.0_05
os.name: Windows XP
os.arch: x86
Adapter: nv4_disp
DriverVersion: null
DisplayVendor: NVIDIA Corporation
DisplayRenderer: GeForce2 MX/AGP/SSE2
DisplayAPIVersion: 1.4.0
java.version: 1.6.0_05
os.name: Windows XP
os.arch: x86
anyone see any patterns? i'm trying to find a decent way to poll for the user's installed total RAM (not just the VM memory), but after googling it does not look doable (at least not in a cross platform way)
For some reason, the "systeminfo" command listed in Microsoft's CMD reference is available neither on my 2000 PC nor my XP PCs. I know of no way to find it with a script.
Interactively, you can do Ctrl-Alt-Delete and bring up the Task Manager. Besides showing the physical RAM total and available, you can see the memory usage per process.
Keep raising your -Xmx until the problem goes away. I've found that the OS will not give you enough RAM so that you cause the system to thrash for swap space. If you get "Could not reserve enough space…" before your OOM exceptions stop, then you need more RAM.
I just wrote a little diagnostic test. Run it like this:
java MemTest -Xmx512m 500
to have the process grab up 500M. Playing with this, you can see how much the OS will allow Java to request with -Xmx. You can also educate yourself about what error messages the JVM will produce for different kinds of memory failures.
NetBeans 6.0 has a build in profiler. Just right click the project and select "Profile", then select "Memory". You play your game for a while then close it. It shows you which methods create the most objects and then you do your stuff.