-xmn– Set the Cenozoic size
Note: The size here is (eden+ 2 survivor Space). The new gen is different from the one shown in Jmap-heap.
entire Heap size = young generation size + old generation size + persistent generation size.
Increasing the younger generation will reduce the size of older generations. This value has a large impact on system performance, and Sun is the official recommended configuration for the entire heap of 3/8
-xx:newratio– The ratio of the Cenozoic (eden+2*s) and older generation (not including the permanent Zone) –4 expressed (
it means 4 times times the age of the new generation.New generation: The old age of =1:4, the young generation of Jian 1/5
-xx:survivorratio– Set the ratio –8 representation of two survivor zones and Eden (
Eden is 8 times times the size of a survivor.) Two survivor:eden=2:8, that is, one survivor for the younger generation of 1/10
export to a specified path when memory overflows
-xx:+heapdumponoutofmemoryerrorExport heap to file when –oom
-xx:+heapdumppath– Export the path to Oom-xmx20m-xms5m-xx:+heapdumponoutofmemoryerror-xx:heapdumppath=d:/a.dump
-xx:onoutofmemoryerror– In Oom, execute a script "-xx:onoutofmemoryerror=d:/tools/jdk1.7_40/bin/printstack.bat%p" when the program is oom, the thread dump will be generated in D:/a.txt You can send messages, even restart programs, when you're in Oom
Summary:adjust the size of the Cenozoic and the surviving generations according to the actual matterOfficial recommendation 3/8 of the Cenozoic Jiansurviving generations of 1/10when you're in oom, remember to dump out the heap to make sure you can troubleshoot the site.
Allocation parameters of the heap