As we all know, the memory of the JVM is limited, one is the architecture of the machine and the other is the operating system itself.
X86,x86-64,sparc,..... Memory mappings are different, and the memory management mechanisms of each operating system differ.
The following is from http://fengyouhua.javaeye.com/blog/58170
1. Heap Settings and garbage collection Java heap are divided into 3 districts, Young,old and permanent. Young saves a newly i
also be implemented into dynamic expansion and contraction of the??However, the current mainstream virtual machines can be dynamically expanded and contracted ( through -xmx and -xms control ). ??A OutOfMemory error will be thrown if there is not enough memory in the heap to complete the instance assignment and the heap can no longer be expanded.??5. Method area??The method area, like the Java heap, is an
first, set the JVM memory settings 1. There are four parameters for setting JVM memory: -xmx Java Heap Maximum, the default value is 1/4 of physical memory, the best setting should depend on the physical memory size and other memory overhead in the computer; -xms Java Heap Initial value, the server side JVM is best to set-XMS and-
% used [average, minimum, 0x00000000e2280000) from space 3584 K, 0% used [clerk, 0x00000000e2600000, 0x000000000000e2980000) to space 3584 K, 0% used [0x000000000000e2280000, 0x0000e2280000, clerk) ParOldGen total 64000 K, used 479 K [Clerk, california, California) object space 64000 K, 0% used [0x00000000a1e00000, California, California) PSPermGen total 21504 K, used 2492 K [0x0000000000009cc00000, 0x000000009e100000, 0x00000000a1e00000) object space 21504 K, 11% used [0x000000009cc00000, 0x000
Java built-in performance monitoring tool: Monitoring and Management Console jconsole usage1. Would you like to verify whether some tuning parameters (such as Xms and Xmx) configured for the jvm work? Do you want to monitor the number of threads in your custom thread pool in real time? Is there a deadlock? Java. lang. OutOfMemoryError:
then it may be transferred to the old age. The new generation holds a large number of short-lived objects, so the new generation has the highest frequency of garbage collection in three regions. For more efficient garbage collection, the new generation continues to be divided into the following three spaces:
Eden
From Survivor
To Survivor
From the memory allocation point of view, the thread-shared Java heap may divide multiple thread-pri
current mainstream virtual machines can be dynamically expanded and contracted ( through -xmx and -xms control ). ??A OutOfMemory error will be thrown if there is not enough memory in the heap to complete the instance assignment and the heap can no longer be expanded.??5. Method Area??The method area, like the Java heap, is an area of memory shared by each thread that stores data such as class information
Regional
Role
Abnormal
Control parameters
Solution Ideas
Java heap
Holds an instance of an object.
Java.lang.OutOfMemory Error:java Heap Space
-xms (Initialize heap),-XMX (Max Heap),-xmn (Cenozoic)
1, first check whether the memory leak (the object in memory is not required), if it is a leak, find the path with GC ROOT to resolve the leak.2, see whether
First, set the JVM memory settings1. There are four parameters for setting JVM memory:-xmx Java Heap Maximum, the default value is 1/4 of physical memory, the best setting should depend on the physical memory size and other memory overhead in the computer;-xms Java Heap Initial value, the server side JVM is best to set-XMS and-
. When implemented, it can be either fixed-sized or extensible, although the current mainstream virtual machines are implemented in a scalable way (via-Xmx and-Xms control). A OutOfMemoryError exception will be thrown if there is no memory in the heap to complete the instance assignment and the heap can no longer be expanded.
The method area method area is used to store data such as class information, constants, static variables, instant compiler co
method executes, except that the virtual machine stack executes the service for the Java program in the virtual machine, and the local method stack executes the service in the Java Virtual machine for the local method. In the virtual machine specification, there is no mandatory requirement for the language, usage and data structure of the methods used in the local method stack;2) Thread Private3) can throw
"Java Learning" "-xmx1024m-xms1024m-xmn512m-xss256k"--java run parameters reprinted June 13, 2016 19:33:38 2792 Young generation concept of the old generation/HTTP The memory of the heap of the jefferent.iteye.com/blog/1123677 JVM is the size of the-XMS minimum heap controlled by the two parameters below, that is, when your virtual machine starts, it allocates so much heap memory to you-
:
Memory size specified by-XMS and-XMX options
Using the-server option
The system does not produce too many timeout logs
That is, if you do not set the memory size and your system generates too many timeout logs, congratulations you need to perform GC tuning for your system.However, keep in mind that GC tuning is a last resort option .Consider the underlying causes of GC tuning. The garbage collector cleans up objects created in
that gets all the data. In general, if you take 100,000 records to memory at a time, it can cause a memory overflow. This problem is more covert, before the line, the data in the database is less,
Not easy to problem, after the on-line, the database more data, a query may cause memory overflow. Therefore, the database query as far as possible in the way of paging query.
④ Check whether the list, map, and other collection objects have not been cleared after use. Collection objects such as List a
. When the old generation has enough space, objects that survive for a certain number of times in the VOR region will be moved to the old generation.
When the space of the old generation is insufficient, the JVM will perform full garbage collection (full GC) in the old generation ).
After full GC, if the primary VOR and the old generation still cannot store the objects copied from the Eden area, the JVM cannot apply for memory for the newly generated object in the Eden area, "Out of memory" ap
limits for the system. Under the 32-bit system, the 1.5g~2g;64 is generally limited to memory unrestricted for the operating system. I test under Windows Server 2003 System, 3.5G physical memory, JDK5.0, Max can be set to 1478m.Typical settings:
java -xmx3550m-xms3550m-xmn2g -xss128k - xmx3550m : Sets the maximum available memory for the JVM to 3550M. -xms3550m : Set the JVM to drive memory to 3550m. This value can be set to the same a
Some suggestions for beginners of Java-Java knowledge points (Java basics) and java knowledge points
The purpose of this article is to summarize some of my experiences in using java over the years, mainly related to some basic java
Some suggestions for beginners of Java ---- Java knowledge points (Java basics), some suggestions ---- java
The purpose of this article is to summarize some of my experiences in using java over the years, mainly related to some basic ja
we have a process that consumes 4G of memory, then the remaining memory calculated by the following formula is the memory that can be used to establish the line stacks. Line stacks total available memory =4g-(value of-XMX)-(value of-xx:maxpermsize)-memory occupied by program countersAs we can see from the above formula, the larger the value of-XMX and MaxPermSize, the smaller the amount of space left to th
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.