First, try to modify the eclipse.ini file
-showsplash
Org.eclipse.platform
--launcher. Xxmaxpermsize
256m
-vm
C:\Java\JDK\1.5\bin\javaw.exe
-vmargs
-xms40m
-xmx512m
Second, Modify the JDK to use memory (this method works)
Locate the window->preferences->java->installed JRE in Eclispe, click the Edit button on the right, and in the "Default VM Arguments" option in the Edit interface, fill in the values below.
Third, Modify Run configurations (this method works)
Right-click on "Run as" and "Run Configurations" in the code and fill in the following values in "VM arguments:" In the arguments parameter.
Four, querying current JVM memory code
The following is the code that queries the current JVM's memory size and can test whether the JVM's memory changes after the above settings. After adding configuration items for JVM memory, you do not need to restart eclipse. The specific code is as follows:
1 Public classTestmemory {2 3 4 5 /**6 7 * @paramargs8 9 */Ten One Public Static voidMain (string[] args) { A -System. Out. println ("Memory info:" +tomemoryinfo ()); - the } - - - + /** - + * Gets the memory information of the current JVM A at * - - * @return - - */ - in Public StaticString Tomemoryinfo () { - to + -Runtime Currruntime =runtime.getruntime (); the * intNfreememory = (int) (Currruntime.freememory ()/1024/1024); $ Panax Notoginseng intNtotalmemory = (int) (Currruntime.totalmemory ()/1024/1024); - the returnNfreememory + "m/" + ntotalmemory + "M (free/total)" ; + A } the +}