2008年11月16日星期日

JAVA 1.6.0_10 -Xmx

依次执行如下命令

C:\Documents and Settings\pprun>ver

Microsoft Windows XP [版本 5.1.2600]

C:\Documents and Settings\pprun>java -version
java version "1.6.0_10"
Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
Java HotSpot(TM) Client VM (build 11.0-b15, mixed mode, sharing)


C:\Documents and Settings\pprun>java -Xmx2048m -version
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

2 G 内存,很新鲜吗?
我刚加了一条,才百多块。
然而,直到我试到 1446 这个可爱的幸运数字时,才成功:
C:\Documents and Settings\pprun>java -Xmx1447m -version
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

C:\Documents and Settings\pprun>java -Xmx1446m -version
java version "1.6.0_10"
Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
Java HotSpot(TM) Client VM (build 11.0-b15, mixed mode)


我立即切换到 Ubunut8.04,进行了一下测试:

pprun@pprun-t61:~$ uname -r
2.6.24-21-generic
pprun@pprun-t61:~$ sudo lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 8.04.1
Release: 8.04
Codename: hardy

pprun@pprun-t61:~$ java -Xmx3072m -version
java version "1.6.0_10"
Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
Java HotSpot(TM) Server VM (build 11.0-b15, mixed mode)

pprun@pprun-t61:~$ java -Xmx3722m -version
java version "1.6.0_10"
Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
Java HotSpot(TM) Server VM (build 11.0-b15, mixed mode)

pprun@pprun-t61:~$ java -Xmx3723m -version
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

是不是 JAVA 也赞成 Windows XP 黑屏?
竟然不能够分配超过 1446m (1.446g) 内存堆!

3 条评论:

Wendal 说...

我的是1443哦.很奇怪!!!

匿名 说...

windows 2003 下可以达到1612m

匿名 说...

C:\Users\****Qing>java -Xmx1584m -version
java version "1.6.0_10"
Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
Java HotSpot(TM) Client VM (build 11.0-b15, mixed mode)