1. Modify eclipse.ini
In the Myeclipse installation directory, G:/MyEclipse8.5/Genuitec/MyEclipse 8.5 has a myeclipse.ini configuration file, which is set as follows:
-vmargs
-Xmx512m
-XX:MaxPermSize=256m
-XX: ReservedCodeCacheSize=64m
2. Set up Default VM Arguments
In myEclipse, open Windows->Preferences->Java->Installed JREs->Click the JDK in use->Edit->Default VM Arguments text box and enter: -Xms64m -Xmx256m
3. If it is a web project and it still reports memory overflow, you may need to set tomcat memory.
(1) Tomcat installation root directory %tomcat%bin/catalina.bat file, SET JAVA_OPTS line;
set JAVA_OPTS=-Xms1024m -Xmx1024m -XX:PermSize=128m -XX:MaxPermSize=256m
The values inside can be adjusted according to the specific situation of the project and the specific situation of the machine.
(2) Myeclipse configuration web server configuration Window—Preferences—Myeclipse—Servers—tomcat 5.x—JDK’s Optional Java VM arguments are configured as:
-Xms256m -Xmx512m -XX:MaxNewSize=256m -XX:MaxPermSize=256m
4. If it is running in debug mode, you need to adjust the virtual machine parameters of debug mode, because the default memory allocation in debug mode is very small.
5. If eclipse runs junit test, encounters memory problems
When running all test cases, I found that it could not be completed. When I came to some test cases, OutOfMemoryError appeared, which was caused by junit, because teardown did not clean up the used memory, so I could only modify the parameters during Run and increase the memory.
The value set when Eclipse starts JUnit is about 64M, and the result of monitoring memory usage after I increase the memory shows that all test cases need to use 100M memory.
The method is: Run->Run…->JUnit->AllTests->(x)=Arguments->VM Arguments: -Xmx500m
Note that the AllTests above is the Test suite class that contains all test cases you want to modify.
-Xmn is a young generation, and generally should not exceed half of the heap size (-Xms and -Xmx)
The above content introduces you to the relevant knowledge about the reasons why MyEclipse memory is insufficient and the solutions. I hope you like it.