tags:

views:

41

answers:

4

I'm starting my server with "java -xms 1280m -xmx 1280m" command. On Linux machines, this works fine and I see the process using almost the same amount of memory. On Windows machines, however, I see the java process using much less than 1280m - around 500-600m. I gathered this data from the windows task manager, if that matters. The two windows machines I checked are both Windows 2003 servers and have 2GB and 3GB RAMs respectively. I always thought that specifying the initial heap size with -xms will force java to use at least that much of memory. Am I wrong? Or, is this a peculiarity with java on Windows?

A: 

Finally back at a computer and ran a couple of quick tests.

On my windows XP machine running java -xms gives the output Unrecognised option

When running java -Xms I get an invalid intial heap size which is correct as I'm not giving any value, but it accepts and recognises the option.

So it seems my comment was valid and you'll need to sort the casing on your command.

Kevin D
Thanks for your comment. My bad. I am using the uppercase option -Xms. So, it's not a question of case.
John Smith
In that case, very puzzling.
Kevin D
Actually I notice your question states "starting my server". Which server and how are you actually setting the Xms etc. The reason I ask in case it is some "run.bat" you are using that either may be ignoring/overwriting/ not getting your options.
Kevin D
I'm using JBoss, but we start it with a custom script (don't ask!). The -Xms is being set in the script, as an argument to 'java ' command.
John Smith
I'm pretty much out of ideas. My last suggestion would be to use sysinternals Process Explorer to inspect the java.exe launched for the jboss server, this will show you the arguments its actually received. If the java process is actually getting your Options... then I'm stumped.
Kevin D
A: 

In addition to what Kevin D said about capitalization, note that 32-bit Windows systems generally have an upper-bound on the max heap size. It tends to vary based on a lot of factors but I've often seen it right around the 1280m that you are trying. I doubt that is the issue here but it could be a related issue.

Michael McGowan
A: 

The windows task manager has been designed for end users, not for programmers. The latter usually prefer the Process Explorer (procexp.exe) from the Sysinternals suite. That, combined with vmmap.exe will show you exactly what is going on.

Roland Illig
Hadn't heard of vmmap... looks pretty handy I'll need to add that to my toolbox. Thanks.
Kevin D
I'll try process explorer and vmmap.exe. Thanks!
John Smith
A: 

Look closer. The task manager is often misleading - by default it will not show how much memory a process has allocated. Rather what is shown as "memory used" is the amount of physical memory swapped in for that process. In the View menu, chose "Select columns" and add "Size of virtual memory". There's your memory. Your application obviously never really uses more than 500-600m, so its never swapped in.

Durandal