-2

Two jvm options that we can provide -Xms and -Xmx which are minimum and maximum heap size for jvm respectively. In a lot of applications, I have noticed both these values to be same. Is there a specific or good reason why developers chose to have both minimum and maximum possible heap to be same?

Thanks

alwaysAStudent
  • 2,110
  • 4
  • 24
  • 47
  • So you can specify exactly how much memory it uses? Seems pretty self explanatory. – user1231232141214124 Feb 03 '16 at 00:11
  • 1
    -Xms is "initial java heap size" and not minimum heap size – Atri Feb 03 '16 at 00:13
  • It takes the JVM time to expand memory. It can cause unnecessary system wide GC, while the JVM works out it needs to allocate more memory. In the case of a server, this is unacceptable. – Boris the Spider Feb 03 '16 at 00:13
  • 1
    Possible duplicate of [What happens when we set Xmx and Xms equal size](http://stackoverflow.com/questions/16087153/what-happens-when-we-set-xmx-and-xms-equal-size) – Atri Feb 03 '16 at 00:15

1 Answers1

-1

One answer could be to avoid memory fragmentation, so the vm would start already with the max allowed allocating size

yugo
  • 188
  • 7