Configure the Java Virtual machine memory size
The maximum memory that a Java virtual machine can use is limited, and the default value is usually 64MB or 128MB. If an application loads the data in memory to improve performance, such as exceeding the default maximum value of 128MB, it needs to increase the maximum memory available to the Java Virtual machine, otherwise an out-of-memory (out-of-system) exception will occur. When you start Java, you need to use the following two parameters:
-xms the size of memory used when initializing a Java virtual machine
-XMX maximum memory that a Java virtual machine can use
The size set in the above two parameters can be taken with a unit, for example: 256m for 256MB
Many of the underlying uses of Java virtual machines (such as TOMCAT) typically require the following configuration items to be configured:
java_opts= '-xms128m-xmx256m '
Use MyEclipse to run the main function to configure the virtual machine's memory through-XMS and-XMX:
Configuration method:
Right-click in the code editing area, run as---run configurations ..., select the second tab (i.e. arguments) in the pop-up window and enter the parameters to be passed in the VM arguments text box such as:-xms88m- Xmx128m, it's best to run it by clicking on Run;
If you want to configure the program's parameters, you need to enter the parameters to pass in the main method in the Programs Arguments text box, and then click Run below.
It is important to note that the main method parameter is an array, if more than one argument is required, the parameters are separated by a space, and any arguments are accessed in the main method by means of an array subscript.
Precautions:
The operating system and JDK need to match, such as 64-bit operating systems need to install 64-bit JDK to use the required memory size, or in jconsole, heap size, the maximum value is 120m.
Configure the Java Virtual machine memory size