I read many post about Java Heap. I saw if we get java.lang.OutOfMemoryError we should increase -Xmx to address this issue.
for e.g
java -Xmx2048m -Xms256m
This will increase heap memory used by Java to 2048MB. Now comes to the question that is knocking on my head.
Question with reference to above settings :
Does Java waits till its HEAP space reach to 256MB before calling garbage collector ? Is this the reason for production we want to have same value for -XMx and -Xms so that Java does not call Heap management before it reach maximum memory allocation ?
I would appreciate if anyone can provide some additional details about -Xmx and -Xms beside Xmx represent max java heap and Xms represent min java heap.