Java PermGen Space OutOfMemory summary 2008-05-28 17:47
The above three article on JVM Performance tuning is summarized as follows:
The JVM heap is divided into three parts
(1) New domain: Storing all New Chengshen objects
(2) Old domain: The object in the new domain is moved into the old domain after a certain number of garbage collection loops
(3) Permanent domain: The storage class and method object, from the configuration point of view, this domain is independent, not included in the JVM heap. The default is 4M. So if your web app uses a lot of third-party jars that are larger than the default size (4M) of the JVM permanent domain (PermGen space), then PermGen space Outof Memory will be generated. So you can configure the parameters in the JVM to avoid this problem: parameters:-xms The size of the initial heap allocation-xmx the maximum heap allocation-xmn the size of the new domain-xx:maxnewsize: new domain Maximum-xx:maxpermsize: The maximum value of a permanent field
Tip: Heap Size is not greater than 80% of the available physical memory, typically to set the-XMS and-XMX options to the same, and-xmn to the-XMX value of 1/4.
If a PermGen space outofmemory occurs, the solution: If your Tomcat is installed in half, you can go into the registry and put a file named options under the Java folder under Tomcat plus a parameter similar to the following:-xms256m- xmx256m-xx:maxnewsize=256m-xx:maxpermsize=256m, you can also use the following methods if you are modifying Tomcat_home/bin/catalina.bat (Windows) or Tomcat for an installation-free version _home/bin/catalina.sh (Linux,unix) is set in the file as follows:
SET java_opts=% java_opts%-xms256m-xmx256m-xx:maxnewsize=256m-xx:maxpermsize=256m "
and restart Tomcat.
Some useful-xx Options
| Option and Default Value |
Description |
| -xx:-allowusersignalhandlers |
Do not complain if the application installs signal handlers. (Relevant to Solaris and Linux only.) |
| -xx:altstacksize=16384 |
Alternate signal stack size (in Kbytes). (Relevant to Solaris only, removed from 5.0.) |
| -xx:-disableexplicitgc |
Disable calls to System.GC (), JVM still performs garbage when collection. |
| -xx:+failovertooldverifier |
Fail The verifier when the new type checker fails. (introduced in 6.) |
| -xx:+handlepromotionfailure |
The youngest generation collection does not require a guarantee to full promotion to all live objects. (Introduced in 1.4.2 Update 11) [5.0 and Earlier:false.] |
| -xx:+maxfdlimit |
Bump the number of file descriptors to max. (Relevant to Solaris only.) |
| -xx:preblockspin=10 |
Spin count variable for use with-xx:+usespinning. Controls The maximum spin iterations allowed before entering system thread operating code. (introduced in 1.4.2.) |
| -xx:-relaxaccesscontrolcheck |
Relax the access control checks in the verifier. (introduced in 6.) |
| -xx:+scavengebeforefullgc |
Do young generation GC prior to a full GC. (introduced in 1.4.1.) |
| -xx:+usealtsigs |
Use alternate signals instead of the SIGUSR1 and SIGUSR2 for VM internal signals. (Introduced in 1.3.1 Update 9, 1.4.1.) Relevant to Solaris only.) |
| -xx:+useboundthreads |
Bind User level threads to kernel threads. (Relevant to Solaris only.) |
| -xx:-useconcmarksweepgc |
Use concurrent Mark-sweep collection for the old generation. (introduced in 1.4.1) |
| -xx:+usegcoverheadlimit |
Use a policy this limits the proportion of the VM ' s time this is spent in GC before a outofmemory error is thrown. (introduced in 6.) |
| -xx:+uselwpsynchronization |
Use lwp-based instead of thread based synchronization. (introduced in 1.4.0.) Relevant to Solaris only.) |
| -xx:-useparallelgc |
Use the parallel garbage collection for scavenges. (introduced in 1.4.1) |
| -xx:-useparalleloldgc |
Use parallel garbage collection for the full collections. Enabling this option automatically SETS-XX:+USEPARALLELGC. (Introduced in 5.0 Update 6.) |
| -xx:-useserialgc |
Use serial garbage collection. (introduced in 5.0.) |
| -xx:-usespinning |
Enable naive spinning on Java Monitor before entering operating system thread Synchronizaton code. (Relevant to 1.4.2 and 5.0 only.) [1.4.2, multi-processor Windows Platforms:true] |
| -xx:+usetlab |
Use Thread-local object allocation (introduced in 1.4.0, known as Usetle prior to that.) [1.4.2 and earlier, x86 or With-client:false] |
| -xx:+usesplitverifier |
Use the new type Checker with stackmaptable attributes. (introduced in 5.0.) [5.0:false] |
| -xx:+usethreadpriorities |
Use native thread priorities. |
| -xx:+usevminterruptibleio |
Thread interrupt before or with eintr for I/O operations results in OS_INTRPT. (introduced in 6.) Relevant to Solaris only.) |