Chinaunix首页 | 论坛 | 博客
  • 博客访问: 642077
  • 博文数量: 95
  • 博客积分: 2091
  • 博客等级: 大尉
  • 技术积分: 982
  • 用 户 组: 普通用户
  • 注册时间: 2007-09-05 19:34
文章分类

全部博文(95)

文章存档

2017年(1)

2016年(20)

2015年(10)

2014年(6)

2013年(4)

2012年(1)

2011年(9)

2010年(6)

2009年(20)

2008年(17)

2007年(1)

我的朋友

分类: Java

2011-04-14 10:51:05


 如何获得JVM的最大可用内存

在命令行下用 java -XmxXXXXM -version命令来进行测试,然后逐渐的增大XXXX的值,如果执行正常就表示指定的内存大小可用,否则会打印错误信息


SUN的1.2.2、1.3.1、1.4.2、1.5.0、IBM1.4.2、BEA JRockit 1.4.2

F:\JDK\1.2.2\bin>java -Xmx700000255M-version
java version "1.2.2"
Classic VM (build JDK-1.2.2_017, native threads, symcjit)

F:\JDK\1.2.2\bin>java -Xmx700000256M-version
Bad max heap size: -Xmx700000256M
Could not create the Java virtual machine.
=====================================================================

F:\JDK\1.3.1\bin>java -version
java version "1.3.1_18"
Java(TM) 2 Runtime Environment, Standard Edition (build1.3.1_18-b01)
Java HotSpot(TM) Client VM (build 1.3.1_18-b01, mixed mode)

F:\JDK\1.3.1\bin>REM If present, the option toselect the VM must be first.

F:\JDK\1.3.1\bin>REM The default VM is-hotspot.

F:\JDK\1.3.1\bin>java -hotspot -Xmx1554M-version
java version "1.3.1_18"
Java(TM) 2 Runtime Environment, Standard Edition (build1.3.1_18-b01)
Java HotSpot(TM) Client VM (build 1.3.1_18-b01, mixed mode)

F:\JDK\1.3.1\bin>java -hotspot -Xmx1555M-version
Error occurred during initialization of VM
Could not reserve enough space for object heap

F:\JDK\1.3.1\bin>java -server -Xmx1522M-version
java version "1.3.1_18"
Java(TM) 2 Runtime Environment, Standard Edition (build1.3.1_18-b01)
Java HotSpot(TM) Server VM (build 1.3.1_18-b01, mixed mode)

F:\JDK\1.3.1\bin>java -server -Xmx1523M-version
Error occurred during initialization of VM
Could not reserve enough space for object heap

F:\JDK\1.3.1\bin>java -classic -Xmx2047M-version
java version "1.3.1_18"
Java(TM) 2 Runtime Environment, Standard Edition (build1.3.1_18-b01)
Classic VM (build 1.3.1_18-b01, native threads, nojit)

F:\JDK\1.3.1\bin>java -classic -Xmx2048M-version
Bad max heap size: -Xmx2048M
Could not create the Java virtual machine.
=====================================================================

F:\JDK\1.4.2\bin>java -version
java version "1.4.2_12"
Java(TM) 2 Runtime Environment, Standard Edition (build1.4.2_12-b03)
Java HotSpot(TM) Client VM (build 1.4.2_12-b03, mixed mode)

F:\JDK\1.4.2\bin>REM The default VM isclient.

F:\JDK\1.4.2\bin>java -client -Xmx1308M-version
java version "1.4.2_12"
Java(TM) 2 Runtime Environment, Standard Edition (build1.4.2_12-b03)
Java HotSpot(TM) Client VM (build 1.4.2_12-b03, mixed mode)

F:\JDK\1.4.2\bin>java -client -Xmx1309M-version
Error occurred during initialization of VM
Could not reserve enough space for object heap

F:\JDK\1.4.2\bin>java -server -Xmx1308M-version
java version "1.4.2_12"
Java(TM) 2 Runtime Environment, Standard Edition (build1.4.2_12-b03)
Java HotSpot(TM) Server VM (build 1.4.2_12-b03, mixed mode)

F:\JDK\1.4.2\bin>java -server -Xmx1309M-version
Error occurred during initialization of VM
Could not reserve enough space for object heap

F:\JDK\1.4.2\bin>REM -hotspot is a synonym forthe "client" VM [deprecated]

F:\JDK\1.4.2\bin>java -hotspot -Xmx1308M-version
java version "1.4.2_12"
Java(TM) 2 Runtime Environment, Standard Edition (build1.4.2_12-b03)
Java HotSpot(TM) Client VM (build 1.4.2_12-b03, mixed mode)

F:\JDK\1.4.2\bin>java -hotspot -Xmx1309M-version
Error occurred during initialization of VM
Could not reserve enough space for object heap
=====================================================================

F:\JDK\1.5.0\bin>java -version
java version "1.5.0_07"
Java(TM) 2 Runtime Environment, Standard Edition (build1.5.0_07-b03)
Java HotSpot(TM) Client VM (build 1.5.0_07-b03, mixed mode,sharing)

F:\JDK\1.5.0\bin>java -client -Xmx1492M-version
java version "1.5.0_07"
Java(TM) 2 Runtime Environment, Standard Edition (build1.5.0_07-b03)
Java HotSpot(TM) Client VM (build 1.5.0_07-b03, mixed mode)

F:\JDK\1.5.0\bin>java -client -Xmx1493M-version
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

F:\JDK\1.5.0\bin>java -server -Xmx1504M-version
java version "1.5.0_07"
Java(TM) 2 Runtime Environment, Standard Edition (build1.5.0_07-b03)
Java HotSpot(TM) Server VM (build 1.5.0_07-b03, mixed mode)

F:\JDK\1.5.0\bin>java -server -Xmx1505M-version
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

F:\JDK\1.5.0\bin>REM -hotspot is a synonym forthe "client" VM [deprecated]

F:\JDK\1.5.0\bin>java -hotspot -Xmx1492M-version
java version "1.5.0_07"
Java(TM) 2 Runtime Environment, Standard Edition (build1.5.0_07-b03)
Java HotSpot(TM) Client VM (build 1.5.0_07-b03, mixed mode)

F:\JDK\1.5.0\bin>java -hotspot -Xmx1493M-version
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.
=====================================================================

F:\JDK\IBM142\bin>java -version
java version "1.4.2"
Java(TM) 2 Runtime Environment, Standard Edition (build1.4.2)
Classic VM (build 1.4.2, J2RE 1.4.2 IBM Windows 32 buildcn1420-20040626 (JIT enabled: jitc))

F:\JDK\IBM142\bin>REM The default VM isclient.

F:\JDK\IBM142\bin>java -Xmx2047M -version
java version "1.4.2"
Java(TM) 2 Runtime Environment, Standard Edition (build1.4.2)
Classic VM (build 1.4.2, J2RE 1.4.2 IBM Windows 32 buildcn1420-20040626 (JIT enabled: jitc))

F:\JDK\IBM142\bin>java -Xmx2048M -version
[ Unable to allocate an initial java heap of 2147483648 bytes.]
[ **Out of memory, aborting** ]
[ ]
[ *** panic: JVMST016: Cannot allocate memory for initial java heap]

abnormal program termination
=====================================================================

F:\BEA\JRockit\bin>java -version
java version "1.4.2_05"
Java(TM) 2 Runtime Environment, Standard Edition (build1.4.2_05-b04)
BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.0-1 (buildari-38120-20041118-1131-win-ia32, Native Threads, GC strategy:parallel)

F:\BEA\JRockit\bin>REM The default VM isjrockit.

F:\BEA\JRockit\bin>java -Xmx1617M -version
java version "1.4.2_05"
Java(TM) 2 Runtime Environment, Standard Edition (build1.4.2_05-b04)
BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.0-1 (buildari-38120-20041118-1131-win-ia32, Native Threads, GC strategy:parallel)

F:\BEA\JRockit\bin>java -Xmx1618M -version
Unable to acquire some virtual address space - reduced from 1656832to 1640260 KB!
java version "1.4.2_05"
Java(TM) 2 Runtime Environment, Standard Edition (build1.4.2_05-b04)
BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.0-1 (buildari-38120-20041118-1131-win-ia32, Native Threads, GC strategy:parallel)

F:\BEA\JRockit\bin>REM -jrockit to select the"jrockit" VM

F:\BEA\JRockit\bin>java -jrockit -Xmx1617M-version
java version "1.4.2_05"
Java(TM) 2 Runtime Environment, Standard Edition (build1.4.2_05-b04)
BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.0-1 (buildari-38120-20041118-1131-win-ia32, Native Threads, GC strategy:parallel)

F:\BEA\JRockit\bin>java -jrockit -Xmx1618M-version
Unable to acquire some virtual address space - reduced from 1656832to 1640260 KB!
java version "1.4.2_05"
Java(TM) 2 Runtime Environment, Standard Edition (build1.4.2_05-b04)
BEA WebLogic JRockit(TM) 1.4.2_05 JVM R24.4.0-1 (buildari-38120-20041118-1131-win-ia32, Native Threads, GC strategy:parallel)


阅读(1909) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~