Re: Should -Xmx be a multiple of -Xms?
On 6/1/2010 11:06 AM, Tom Anderson wrote:
Hello,
A colleague mentioned that he'd heard (from this guy's cousin's
mechanic's guy who he met in a bar's grandfather's dealer's sysop) that
the JVM requests memory from the OS in chunks of the size of -Xms, and
that you should therefore always set -Xmx to be a whole multiple of
-Xms, otherwise it would never actually request its way up to it
(because you can't make a litre from any whole number of fluid ounces).
I think i'd heard something similar at some point, although from a less
reliable source.
Is there any truth to this? Was there ever?
This doesn't sound true to me. I would even venture that the JVM is
likely to use an exponential algorithm instead of a multipling one, eg.
when the heap needs to grow, it doubles in size. I would also guess
that it would "cap" the value to -Xmx *after* it tries to double, so
that you still use the full -Xmx value.
This, of course, is just speculation on my part. I'm under the
impression that nothing in the JVM is still a "naive" implementation,
and one would have to be pretty naive to implement the growth function
that way.
--
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>