Too small initial heap for new size specified

-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];

posted @ 2018-03-23 16:30  有梦就能实现  阅读(446)  评论(0编辑  收藏  举报