-Xms 初始堆大小,这个值不能太小,其初始空间(即-Xms)是物理内存的1/64,这个值不能太小,比如 设置了-Xms1m,运行可能会出现

  Error occurred during initialization of VM

  Too small initial heap for new size specified

 

-Xmx 堆大小上限,最大空间(-Xmx)是物理内存的1/4,假如程序中分配的内存超过了这个限制,那么会出现

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

代码为:

byte[] b = new byte[100000000];

  Error occurred during initialization of VM

  Too small initial heap for new size specified

 

-Xmx 堆大小上限,最大空间(-Xmx)是物理内存的1/4,假如程序中分配的内存超过了这个限制,那么会出现

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

代码为:

byte[] b = new byte[100000000];

相关文章:

  • 2022-01-19
  • 2022-12-23
  • 2022-12-23
  • 2021-11-10
  • 2022-12-23
  • 2021-09-06
  • 2022-12-23
猜你喜欢
  • 2022-03-01
  • 2021-07-01
  • 2021-09-06
  • 2022-12-23
  • 2022-02-16
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案