Java Memory Series: testing JDK maximum memory

Source: Internet
Author: User
The maximum memory that is supported by each version of the JDK in different operating systems is not the same, but can be tested in the following ways.

C:>JAVA-XMXXXXM (g)-version

where xxx is the maximum memory value, M (g) is the measurement unit of memory, if the command can correctly display the version of the JDK and other information, indicating that the current JDK support testing the maximum memory

Quantity, otherwise the memory of the test exceeds the maximum supported by the JDK.

For example: My system is win7 64-bit
Java code c:\users\thinkpad>java-xmx16g-version Java version "1.6.0_30" Java (TM) SE Runtime Environment (build 1.  6.0_30-B12) Java HotSpot (TM) 64-bit Server VM (build 20.5-b03, mixed mode) Java code c:\users\thinkpad>java-xmx16g -version java Version "1.6.0_30" Java (tm) SE Runtime Environment (build 1.6.0_30-b12) Java HotSpot (tm) 64-bit Serve R VM (build 20.5-b03, Mixed mode)
C:\users\thinkpad>java-xmx16g-version
java Version "1.6.0_30"
Java (TM) SE Runtime Environment (build 1.6.0 _30-B12)
Java HotSpot (TM) 64-bit Server VM (build 20.5-b03, Mixed mode)


When you can't support it, you'll get an error.
Java code c:\users\thinkpad>java-xmx16000g-version Error occurred during initialization of VM could not reserve Enough space forObject heap could not create the Java virtual machine. Java code c:\users\thinkpad>java-xmx16000g-version Error occurred during initialization of VM could not reserve en Ough space for object heap the could not create the Java virtual machine.
C:\users\thinkpad>java-xmx16000g-version
Error occurred during initialization of VM
could not reserve Enough space for object heap the
could not create the Java virtual machine.


Generally on the 32-bit machine, the maximum is located between the 1.5g-2g, on the 64-bit machine should have no restrictions on the above, the test to write 16G can also be the normal version of the information

Reprinted from: Black Hair: http://heisetoufa.iteye.com/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.