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