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

MinecraftShamrock picture MinecraftShamrock · May 16, 2014 · Viewed 24.7k times · Source

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?

Answer

Sanjeev picture Sanjeev · May 16, 2014

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.