« | August 2025 | » | 日 | 一 | 二 | 三 | 四 | 五 | 六 | | | | | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | | | | | | | |
| 公告 |
戒除浮躁,读好书,交益友 |
Blog信息 |
blog名称:邢红瑞的blog 日志总数:523 评论数量:1142 留言数量:0 访问次数:9689547 建立时间:2004年12月20日 |

| |
[jvm]JVM - Could not reserve enough space for object heap的解决 原创空间, 文章收藏
邢红瑞 发表于 2010/1/26 17:02:38 |
程序启动时,出现Error occurred during initialization of VMCould not reserve enough space for object heapCould not create the Java virtual machine.以前在solaris遇到过swap空间不够,#mkfile 500m /opt/myswap#swap -a /opt/myswap讲/opt/myswap加入/etc/vfstablinux上32-bit JVM 只能访问2G的内存空间,减少-mmx的值就行了,如果在windows上使用jrockit,可以使用3G空间,public class MemLoadTester { public static void main ( String[] args ) {
long rand; char cr; char[] cra = new char[2048];
for ( int i=0; i<2048; i++) { rand = 70 + Math.round( Math.random() * 50); cr = (char) rand; cra[i] = cr; }
int entities = 800000; int blocksize = 10240;
String[] zz = new String[ entities];
// Java char type is 2bytes. System.out.println (" Each box indicates the creation of ~40Meg");
for ( int j=0; j<entities; j++ ) { zz[j] = new String( cra ); if (j != 0 && j % blocksize == 0 ) { System.out.print ( "#" ); }
if (j != 0 && j % (blocksize * 10) == 0 ) { System.out.println ( "" );
}
}
System.out.println( "\n");
} System.out.println ( " Success ");} |
|
|