Your SlideShare is downloading. ×
Jvm的最小使用内存测试
Jvm的最小使用内存测试
Jvm的最小使用内存测试
Jvm的最小使用内存测试
Jvm的最小使用内存测试
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Jvm的最小使用内存测试

2,005

Published on

Jvm的最小使用内存测试

Jvm的最小使用内存测试

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
2,005
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
14
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Java 的最小使用内存测试 Zianed Hou zianed@live.cn //T.java public class T{ public static void main(String[] args){ System.out.println("Hello World!"); } } //T.bat @echo off javac T.java java -Xms%1 -Xmx%1 T //T.sh #!/bin/bash javac T.java java -Xms$1 -Xmx$1 T 运行方式: $./T.sh 1M cmd>T.bat 1M 1、测试环境 IntelX86-Win32 1
  • 2. 看出 IntelX86-Win32 上的最小内存要求为 1M。 2、Sparc 机器 root@test-177-ce0 # uname -a SunOS test-177-ce0 5.10 Generic_120011-14 sun4u sparc SUNW,Sun-Fire-V490 root@test-177-ce0 # java -version java version "1.5.0_12" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_12-b04) Java HotSpot(TM) Server VM (build 1.5.0_12-b04, mixed mode) root@test-177-ce0 # cat T.sh #!/bin/bash javac T.java 2
  • 3. java -Xms$1 -Xmx$1 T root@test-177-ce0 # chmod u+x T.sh root@test-177-ce0 # root@test-177-ce0 # java -Xms2m -Xmx2m T Error occurred during initialization of VM Too small initial heap for new size specified root@test-177-ce0 # java -Xms4m -Xmx4m T Hello World! root@test-177-ce0 # java -Xms3m -Xmx3m T Hello World! root@test-177-ce0 # root@test-177-ce0 # cat T.sh #!/bin/bash javac T.java java -Xms$1 -Xmx$1 T root@test-177-ce0 # ./T.sh 1m Error occurred during initialization of VM Too small initial heap for new size specified root@test-177-ce0 # ./T.sh 2m Error occurred during initialization of VM Too small initial heap for new size specified root@test-177-ce0 # ./T.sh 3m Hello World! 看出 Sparc64 位上的最小内存要求为 2M。 3、AIX 上 -bash-3.00$ prtconf -c CPU Type: 64-bit -bash-3.00$ ls -l /unix 3
  • 4. lrwxrwxrwx 1 root system 21 2008-07-28 16:16 /unix -> /usr/lib/boot/unix_64 -bash-3.00$ -bash-3.00$ -bash-3.00$ uname -a AIX aix 3 5 00C97AC04C00 powerpc unknown AIX -bash-3.00$ java -version java version "1.4.2" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2) Classic VM (build 1.4.2, J2RE 1.4.2 IBM AIX build ca142-20070708 (SR9) (JIT enabled: jitc)) -bash-3.00$ ./T.sh 512k [ The specified initial heap size is too small. (1048576 bytes required.) ] Could not create the Java virtual machine. -bash-3.00$ ./T.sh 1000k [ The specified initial heap size is too small. (1048576 bytes required.) ] Could not create the Java virtual machine. -bash-3.00$ ./T.sh 2000k Hello World! -bash-3.00$ 看出 AIX 上的最小内存要求 1048576 bytes required.即 1M。 4、64 位的 Ubuntu 上 Zianed@ubuntu:~$ uname -a Linux ubuntu 2.6.24-22-generic #1 SMP Mon Nov 24 19:35:06 UTC 2008 x86_64 GNU/Linux Zianed@ubuntu:~$ java -version java version "1.6.0_07" Java(TM) SE Runtime Environment (build 1.6.0_07-b06) Java HotSpot(TM) 64-Bit Server VM (build 10.0-b23, mixed mode) Zianed@ubuntu:~$ javac -version javac 1.6.0_07 Zianed@ubuntu:~$ ./T.sh 1m Error occurred during initialization of VM Too small initial heap for new size specified Zianed@ubuntu:~$ ./T.sh 2m Error occurred during initialization of VM Too small initial heap for new size specified Zianed@ubuntu:~$ ./T.sh 4m Hello World! Zianed@ubuntu:~$ ./T.sh 3m Hello World! 4
  • 5. Zianed@ubuntu:~$ 看出 Ubuntu64 位上的最小内存要求 2M。 5、x86 的 Solaris 上 -bash-3.00$ isainfo -vk 64-bit amd64 kernel modules -bash-3.00$ uname -a SunOS x4100 5.10 Generic_118855-33 i86pc i386 i86pc -bash-3.00$ java -version java version "1.5.0_07" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_07-b03) Java HotSpot(TM) Server VM (build 1.5.0_07-b03, mixed mode) -bash-3.00$ ./T.sh 1m Hello World! -bash-3.00$ ./T.sh 512k Error occurred during initialization of VM Too small initial heap -bash-3.00$ ./T.sh 1000k Hello World! -bash-3.00$ 看出 Solaris 的 x86 位上的最小内存要求 1M。 结论如下: 对于 x8632 位的系统,JVM 要求的最小内存为 1M= 1048576 bytes。 对于 x8664 位的系统, Linux 上 JVM 要求的最小内存为 2M= 2097152 bytes。 Solaris 上 JVM 要求的最小内存为 1M= 1048576 bytes。 对于 Sparc64 位的系统,JVM 要求的最小内存为 2M= 2097152 bytes。 对于 Aix64 位的系统,JVM 要求的最小内存为 2M= 2097152 bytes。 5

×