Avoiding Initial Memory Heap Size Error

前端 未结 3 870
清酒与你
清酒与你 2020-12-03 10:38

I run a Java code with the following command:

$ java -Xms4G -Xmx4G myjavacode

My cpu\'s RAM capacity is 6GB.

However it always fail

3条回答
  •  无人及你
    2020-12-03 11:12

    Actually, the maximum memory size on 32-bit systems can vary, being anything up to 4 GB, but 2 GB is a common value. It's often possible to re-link your kernel to increase this to 3 or 3.5 GB. The issue, of course, is that you just don't have the address space to map more memory. Have you tried a 64-bit machine?

    Also, remember to set your ulimit higher before you do this.

提交回复
热议问题