Eclipse Runtime program times Java.lang.OutOfMemoryError:Java heap space Insufficient memory issue

Source: Internet
Author: User
Tags xms

System.setproperty ("Webdriver.firefox.bin",        "D:\\mozilla firefox\\firefox.exe"New = Pi.getprofile ("Default"new  firefoxdriver (profile);d river.get ("http/  Hao123.com ");

Run to

Webdriver Driver = new Firefoxdriver (profile);

When suddenly reported Java.lang.OutOfMemoryError:Java heap space,

The root of the problem is that the default heap size of the JVM virtual machine is 64M, which can be achieved by setting its maximum and minimum values.

The JVM heap setting is the set of memory space that the JVM can provision in the course of running the Java program.

The JVM automatically sets the value of the heap size when it starts, and its initial space (that is,-XMS) is 1/64 of the physical memory, and the maximum space (-XMX) is 1/4 of the physical memory. You can use options such as the-XMN-XMS-XMX provided by the JVM to set it up.

Example: java-jar-xmn16m-xms64m-xmx128m Myapp.jar

If the heap size setting is small, in addition to these exception information, you will notice that the program's responsiveness slows down. The GC takes up more time and the application is assigned less execution time.

The Heap Size does not exceed 80% of the available physical memory, generally the-XMS and-XMX options are set to the same, and the-XMX value of-xmn is 1/4.
The-XMS-XMN setting of the Heap size does not exceed the size of the physical memory. Otherwise, "Error occurred during initialization of VM Could not reserve enough space for object heap" will be prompted.

-xms <size>
Set JVM initialization heap memory size

-xmx <size>
To set the maximum heap memory size for the JVM

Setup steps:

Fill in the-xms64m-xmx512m and click Apply-> Run on it!

Reference Details:

http://blog.csdn.net/jxzxm1_2/article/details/2499751

Https://zhidao.baidu.com/question/1830186099735337420.html

Http://www.cnblogs.com/zzblee/p/4038370.html

Eclipse Runtime program times Java.lang.OutOfMemoryError:Java heap space Insufficient memory issue

Related Article

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.