Search code examples
javalinuxheap-size

Java heapsize in Linux box


Can I do -Xmx1792m in Linux box

If I have like this

MemTotal:        10145678 kb
MemFree :          256128 kb
Cached :          9216534 kb
SwapTotal:        2097124 kb
SwapFree:         2045263 kb
Buffers :          243208 kb
Active:           3283536 kb
Inactive:         6224084 kb
VmallocTotal: 34359738367 kB
VmallocUsed:       303168 kB
VmallocChunk: 34359423100 kB

Solution

  • It is perfectly fine to run a 1,5GB Java Heap on a 10GB box, why do you think otherwise? In Linux you need to add cached+buffer to free to see what is unused. If you use the free command, it will do that for you. Make sure to leave some room for buffers, of course.