You can set the memory used for the Java virtual machine, but the virtual machine will not compensate if your choice is incorrect. You can use the command line to change the memory used by the VM. The following table shows two parameters used to set the memory used by the VM.
Parameter description
-Size of the heap initialized by XMS JVM
-Maximum value of xmx JVM heap
The size of these two values is generally set as needed. The size of the initialization heap is the size of the memory applied by the VM to the system at startup. In general, this parameter is not important. However, some applications use more memory at a high load, and this parameter is very important, if the VM is set to use a small amount of memory during startup and many objects are initialized in this case, the VM must repeatedly increase the memory to meet the requirement. For this reason, we generally set-XMS to the same size as-xmx, and the maximum heap size is limited by the physical memory used by the system. Generally, applications with large data volumes use persistent objects, and memory usage may increase rapidly. When the memory required by the application exceeds the maximum value of the heap, the VM will prompt a memory overflow and cause the application service to crash. Therefore, we recommend that you set the maximum value of the heap to 80% of the maximum available memory.
-------------------------------------
By default, Tomcat can use 128 MB of memory. In large application projects, this memory is insufficient and needs to be increased.
In Windows, the file {tomcat_home}/bin/Catalina. in bat and UNIX, the file {tomcat_home}/bin/Catalina. before SH, add the following settings: java_opts = '-XMS [initial memory size]-xmx [maximum memory available ]'
You need to increase the value of these two parameters. For example:
Java_opts = '-xms256m-xmx512m'
Indicates that the initial memory is 256 MB, and the maximum memory available is 512 MB.
--------------------------------------
By default, JBoss can use 64 MB of memory.
$ Jbossdir $/bin/run. config
Java_opts = "-server-xms128-xmx512"
--------------------------------------
Go to the console to set WebSphere (omitted)
--------------------------------------
Eclipse
In the directory, Type
Eclipse.exe-vmargs-xms256m-xmx512m
M indicates the minimum JVM heap memory size.
M indicates the maximum JVM heap memory
--------------------------------------
Reference from http://hi.baidu.com/javahua/blog/item/e15d7f09008139c73ac7634c.html