Heap memory is divided into two parts: new and old, The new Part includes the newly created object area and two movie vor areas (SS #1 and SS #2). The newly created object is allocated with a new object, long-lived objects are moved to the old part. Perm is a permanent Region allocated to the JVM in this province. You can set it using the command line parameter-XX: maxpermsize = 64 m. When new is filled up, the "Auxiliary" GC will be triggered to move objects that have been in the old state for a long time. When old is also filled up, the "Main" GC will be triggered to traverse all objects in the heap memory. It can be seen that the "Main" GC consumes more time. New with a large enough size will be suitable for objects that need to be created for a large number of objects with a short time. If old is not enough, it will trigger the "Main" GC frequently, greatly reducing the performance. Therefore, our task is to set the heap memory size and plan the ratio of the New and Old areas to fit our application. "Auxiliary" GC use copy/scavenge collectionAlgorithm, "Main" GC uses mark-compact collection. Example: Java-server-XX: newsize = 128 M-XX: maxnewsize = 128 M-XX: Export vorratio = 8-xms512m-xmx512m server application name Suggestions 1) set-the size of-XMS and-xmx to be equal, so as to avoid adjusting the heap memory size after each GC. 2) Similarly, newsize and maxnewsize are equal. The size of "new" should not be greater than half of "old ". |