On 19.03.2017 20:33, Olaf Kock wrote:


Am 19.03.2017 um 13:37 schrieb André Warnier (tomcat):
On 17.03.2017 14:54, Christopher Schultz wrote:


Note that Java *never* gives any memory back to the OS, even when the
heap-usage goes down. This is a Java thing, not a Tomcat thing.

I did not know that (*), and I have never seen this mentioned
explicitly in any Java documentation (not that I have read many).
What is the point of the Java "-Xms" and "-Xmx" command-line
parameters then (when they have different values).
I can't remember where I've seen it, but it's been ages ago and I assume
it since eternity.

The difference between -Xms and -Xmx is:
$ java -X 2>&1 | grep "Java heap size"
     -Xms<size>        set initial Java heap size
     -Xmx<size>        set maximum Java heap size

i.e. -Xms only talks about the /initial/, not about the minimal heap size.

Aaah. That may be where my confusion got in, indeed. I was assuming it to be both the initial and minimal heap size, and was hitherto assuming that when Java doesn't need such a big Heap anymore, it returns the surplus memory to the OS.


In production systems I religiously set both sizes to identical values,
assuming that otherwise allocation of more than the initial memory will
fail sunday night at 3am instead of right when the JVM is started.

Yes, so do I, for the same reason, /and/ to save that smidge of overhead which would be otherwise due to the Java JVM having to resize the Heap regularly. Which is another thing which I read once somewhere and believed, without ever really having gone to the bottom of it.

One may wonder in fact : if when resizing the Heap downwards, the JVM is anyway not going to give the surplus memory back to the OS, then why bother ? what is the surplus ex-Heap memory then used interestingly for, by the JVM ?


Olaf


(*) I thought it was only perl doing that


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to