Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java Memory Limit -Xmx suffix: upper vs lower case m/M and g/G [duplicate]

Tags:

It is commonly known that it is possible to limit the Java heap size with -Xmx<amount><unit>, where unit is the data amount unit like Gigabyte, Megabyte, etc. I know that -Xmx128M means 128 Mebibytes (= 128 * 1024 * 1024 bytes).

But is it true, that it is also possible to use decimal units like megabytes using -Xmx100m (which would be 100 * 1000 * 1000 bytes)?

So is it possible to use this decimal units by using lower-case unit suffixes like k, m, g instead of K, M, G?

like image 486
MinecraftShamrock Avatar asked May 16 '14 16:05

MinecraftShamrock


2 Answers

There is no difference between k and K both means kibibyte and so does m/M = mebibyte & g/G = gibibyte. you can set 100m as the value and it will be 100 * 1024 * 1024 bytes. generally it is advised to use this value in powers of 2.

Hope it helps.

like image 88
Sanjeev Avatar answered Sep 17 '22 19:09

Sanjeev


Why don't you just try -Xmx100m and -Xmx100M and check if there is any difference.
k, m, g work exactly like K, M, G - they all mean binary units.

like image 37
apangin Avatar answered Sep 18 '22 19:09

apangin