1. Heap and non-heap (non-heap) memory
According to the official statement, "Java virtual machines have a heap, the heap is a runtime data region, and all class instances and arrays of memory are allocated from here." The heap is created when the Java virtual machine is started. "" The memory outside the heap in the JVM is called non-heap (non-heap memory) ". You can see that the JVM primarily manages two types of memory: heap and non-heap. In a nutshell, a heap is a Java code-readable memory that is left to the developer, not a heap, which is left to itself by the JVM, so the method area, the JVM internally processes or optimizes the required memory (such as the JIT-compiled code cache), each class structure (such as running a constant pool, field, and method data) And the code for methods and construction methods are in non-heap memory.
2. Heap Memory allocation
The initial memory allocated by the JVM is specified by-XMS, the default is physical memory 1/64;JVM the maximum allocated memory is specified by-XMX, which defaults to 1/4 of the physical memory. When the default free heap memory is less than 40%, the JVM increases the heap until the maximum limit of-xmx, and when the free heap memory is greater than 70%, the JVM reduces the heap until the minimum limit of-XMS. So the server generally sets-xms,-xmx equal to avoid resizing the heap after each GC.
3. Non-heap memory allocation
The JVM uses-xx:permsize to set the non-heap memory initial value, which defaults to 1/64 of the physical memory, and the maximum non-heap memory by Xx:maxpermsize, which by default is 1/4 of physical memory.
4.JVM memory Limit (max)
First, the JVM memory is limited to the actual maximum physical memory, assuming that the physical memory is infinitely large, the maximum value of the JVM memory is very much related to the operating system. In short, the 32-bit processor, although the controllable memory space has 4GB, but the specific operating system will give a limit, This limit is generally 2GB-3GB (typically under Windows systems for the 1.5g-2g,linux system 2g-3g), and processors over 64bit are not limited.
To illustrate the meaning:
-xms128m represents the JVM heap (heap memory) minimum size 128MB, initial allocation
-XMX512M represents the maximum allowable size of the JVM heap (heap memory) of 256MB, on demand.
Note: If-XMX is not specified or is specified as small, the application may cause a java.lang.OutOfMemory error from the JVM that is not throwable and cannot be captured with Try...catch.
The permsize and MaxPermSize indicate that the virtual machine is a Java-generated object (permanate generation) such as the class object, the method object, these reflective (reflective) objects are allocated memory limits, The memory is not included in the heap memory area.
-XX:PERMSIZE=64MB minimum size, initial allocation
-XX:MAXPERMSIZE=256MB maximum allowable allocation size, on demand
Too small will cause: Java.lang.OutOfMemoryError:PermGen space
The MaxPermSize default value is related to the-server-client option. -server option under Default MaxPermSize is 64m-client option under Default MaxPermSize to 32m
PS: Different manufacturers of the JDK garbage collection algorithm is not the same. Under Sun's JDK, XMS and XMX settings can reduce the pressure on the size of the scaling heap, but under IBM's JDK, setting it up will increase the chance of heap fragmentation.
The following is a simple way to optimize the myeclipse speed of the Main method:
1. Modify the Myeclipse.ini.
2. Cancel Automatic validation
3. Tick off the useless plugin.
4. Modify the boot loader module
The detailed optimization MyEclipse speed method is attached below: ()
http://yufenfei.javaeye.com/blog/376464
Http://blog.csdn.net/defonds/archive/2009/07/10/4338782.aspx
http://zhangpengshou.javaeye.com/blog/198476
http://queue19.javaeye.com/blog/488017
Original source: http://www.blogjava.net/landon/archive/2010/04/26/319402.html