JVM - parameter settings

1. Set JVM parameters in the eclipse open eclipse-Window - Preferences-Java-installed JRE (in the current development environment for running java programs are effective, which is running in the eclipse java program) to edit the current use of the JRE , enter the default VM parameters:-Xmx128m-Xms64m-Xmn32m-Xss16m

Or when running a java program execution: java-Xmx128m-Xms64m-Xmn32m-Xss16m Test

Test is a class file

2. In the Tomcat server, set the JVM parameters

set CATALINA_OPTS =- Xmx512m-Xms512m-Xmn64m-Xss2m or

set JAVA_OPTS =- Xmx512m-Xms512m-Xmn64m-Xss2m

Set JAVA_OPTS CATALINA_OPTS and is a token, when you start tomcat set parameters.

Is the difference between the two JAVA_OPTS in tomcat stop time will also run this command.

3. View the size of the heap

Return value in bytes, of course, you can view other JVM parameters.

Runtime.getRuntime (). MaxMemory ();

4. Java heap memory and the memory can be divided into non-heap memory

Reactors and non-heap: Heap is for developers use, that were created in the JVM; non-JVM heap is reserved for their own use, used to store types (classes and interfaces) of information. And heap it is different from running during the GC will not free up space. If the web app jar with a large number of third-party applications or too many class files just MaxPermSize set smaller than a piece of memory usage can lead to overflows caused by excessive or tomcat hot deployment does not clean up the front Hou loading environment will only change to the new deployment of context, non-stacking more and more content will be hot deployed on several occasions to java.lang.OutOfMemoryError: PermGen space.

---- Heap memory settings: program can reach, and can operate
-Xms initial heap memory physical memory by default 1 / 64, is the smallest allocation of heap memory. When less than 40% of free heap memory, it will increase the maximum limit-Xms

-Xmx maximum heap memory allocation of physical memory by default 1 / 4, when the free heap memory is greater than 70%, will be reduced to the minimum-Xms restrictions.
General set-Xms and Xms equal

---- Non-heap memory settings
-XX: PermSize the initial value of non-heap memory, the default physical memory of 1 / 64, is the smallest non-heap memory.
-XX: MaxPermSize maximum value of non-heap memory, the default physical memory of 1 / 4

5. Typical JVM parameters:


-Xmx128m: set the maximum JVM memory available for the 128M.

-Xms128m: Set JVM memory minimum 128m. This value can be set with-Xmx the same time to avoid the JVM garbage collection is complete re-allocate memory.

-Xmn2g: set the young generation size is 2G. The young generation heap size = size + size + lasting on behalf of the elderly on behalf of the size. Persistence on behalf of the general fixed size of 64m, so the young generation increases, will reduce the old generation of size. This value is greater impact on system performance, Sun officially recommended configuration for the whole heap of 3 / 8.

-Xss128k: Set each thread stack size. JDK5.0 after each thread stack size is 1M, before each thread stack size 256K. Depending on the application memory size required to adjust the thread. Under the same physical memory, decrease this value can generate more threads. But the operating system on the number of threads within a process is still limited, not infinite generation, empirical value of about 3000 to 5000.

- Ratio British accent: ['reiseu] ratio
- Eden Eden
- Survivor Survivor

java-Xmx3550m-Xms3550m-Xss128k-XX: NewRatio = 4-XX: SurvivorRatio = 4-XX: MaxPermSize = 16m-XX: MaxTenuringThreshold = 0

-XX: NewRatio = 4: set the younger generation (including Eden and two Survivor areas) and the ratio of older generation (except permanent generation). Set to 4, the share of the young generation and old generation of the ratio of 1:4, the young generation of the total stack of 1 / 5

-XX: SurvivorRatio = 4: set the young generation in the Eden area and the size ratio of Survivor. Set to 4, the two Survivor Eden district area and a ratio of 2:4, the total area of a younger generation of Survivor 1 / 6

-XX: MaxPermSize = 16m: Setting persistent on behalf of the size of 16m.

-XX: MaxTenuringThreshold = 0: Set the maximum age of garbage. If set to 0, then the younger generation of the object without Survivor areas, directly into the old generation.
For the older generation of relatively large number of applications that can improve efficiency. If this value is set to a large value, the younger generation of the object area in the Survivor multiple copies, so that the object and then the young generation can increase the survival time and increase recycling in the young generation of Jibei Introduction.
标签: java lang, eclipse, development environment, java program, parameter settings, test test, current development, memory allocation, tomcat server, memory usage, outofmemoryerror, java programs, memory settings, physical memory, program execution, party applications, maximum limit, stop time, free heap memory, reactors
分类: Java
时间: 2011-01-03


  1. websphere JVM parameter settings (support Chinese)

    In the websphere console. Applications / server1 / process definition / java Virtual Machine / Universal jvm p ...
  2. java virtual machine jvm memory settings on the tuning

    java virtual machine jvm memory settings on the tuning JVM memory settings for the principle of The default ja ...
  3. Comprehensive understanding of Eclipse in the JVM memory settings

    Eclipse in the JVM memory settings you are familiar with, according to the official statement: "Java virt ...
  4. BIRT Viewer 2.2 Detailed parameter settings - turn

    Detailed parameter settings BIRT Viewer 2.2 2007.08.24 BIRT as a powerful open source reporting tools, the upg ...
  5. Java Virtual Machine (JVM) memory settings in the Detailed

    Reprinted: In larger-scale applications, Java Virtual Machine ...
  6. Oracle Database REMOTE_LOGIN_PASSWORDFILE parameter settings

    About Oracle Database REMOTE_LOGIN_PASSWORDFILE parameter settings Oracle utility orapwd command can be used t ...
  7. android software parameter settings stored and read attached source

    Data stored in a different way. Sharedperferences The parameters used to save the software settings, such as u ...
  8. In the jsp to display pdf | | website directly open PDF in IE to display pdf documents and parameter settings

    align = center] in jsp to display pdf | | Web directly open the PDF in IE to display pdf documents and paramet ...
  9. Hibernate's HQL in parameter settings in

    I usually use Hibernate, because between tables are not accustomed to associate, it is usually used when the H ...
  10. Eclipse in the JVM memory settings

    Top of page Top】 eclipse.ini memory settings -vmargs-Xms128M-X ...
  11. JAVA Performance Tuning-Sun Hotspot JDK JVM parameter

    (Transfer from: ) Mainly based on this PDF ( GCTu ...
  12. JavaScript using the cookie, parameter settings, read, write, delete function

    Set cookie Each cookie is a name / value pair, following a string can be assigned to document.cookie: document ...
  13. JavaScript using the cookie, parameter settings, notes; read, write, delete function

    cookie Overview In the previous section, the framework has been used to store a constant shopping column data, ...
  14. In larger-scale applications, Java Virtual Machine (JVM) memory settings is particularly important to achieve good efficiency in the project, GC (garbage collection) set is the first step. PermGen space

    Basic knowledge JAVA 6 Pz% @ 5P 1, object-oriented features are what yl3 = V 5b 1. Abstraction: 8 9M.C | Dkf A ...
  15. The MaxPermSize JVM parameter

    In the JVM in addition to younger generations, older generation of, but also a lasting generations, mainly use ...
  16. -Jar classpath parameter settings when running the application methods (transfer)

    Reproduced, the source is unknown a When using java-jar yourJarExe.jar to run a packaged application through t ...
  17. MOTO702 Camera parameter settings on the camera issue on

    Custom photo Android (HTC, MOTO702) Note: Camera I have been abstracted (factory) /* * Copyright (C) 2010 More ...
  18. IDEA IDEA 9 shortcut keys utf-8 encoding parameter settings to set encoding settings configuration

    1. IDEA memory optimization to look at your configuration and configure the machine itself. \ IntelliJ IDEA 8 ...
  19. JVM memory settings on the

    Running map, reduce the JVM memory tuning tasks: (I was in jobtracker and tasktracker on these two parameters ...