Hello Thomas.
> -Xms will set the minimum memory usage. The JVM doesn't have to use all
> the memory allowed by -Xmx. However, with -server the SoftReference
> behaviour is based on maximum rather than currently allocated memory.
> > -Xms will set the minimum memory usage. The JVM doesn't have to use all
> > the memory allowed by -Xmx. However, with -server the SoftReference
> > behaviour is based on maximum rather than currently allocated memory.
>
> The problem is that I do not know which value to use for -Xmx as I don't
> know the amount of physical memory on the client machines.
You could incorporate that knowledge into whatever code launches your Java
program. For instance if that is a shell script, then the script could
interrogate the OS (in a system dependent way) and choose flags to the "java"
program appropriately. Alternatively you could write your own replacement for
"java" / "java.exe" which did the same thing in C. Lastly you could ask the
user as part of installation (with an option change it later) and stuff the
supplied value into some file which is read by the launcher (not the Java
program).
> I didn't really get your point about the -server command line option.
I assume Thomas means that the server JVM (invoked by -server command-line
flag) uses the supplied maximum to determine how much memory it should allow
soft-references to consume. (Recall that soft refs are used to implement
caches, where data is kept in memory in case it is needed later, but which can
be thrown away if the JVM finds that it doesn't have enough memory for more
necessary work).
-- chris