Get Started With Java JVM Memory (Heap, Stack, - Xss - Xms - XMX - Xmn... ) - Avri Blog
Get Started With Java JVM Memory (Heap, Stack, - Xss - Xms - XMX - Xmn... ) - Avri Blog
Avri Blog
Blog l'avricot - Lord Of Castle, java, nosql, Utomia, AvriChat, javascript, Json, Css, Mootools, ajax, php... Stop Bubble | Start
a full html5 space mmorts using websocket and - Java - MultiThread singleton - LocalThread vs
Get started with java JVM memory (heap, stack, -xss -xms -xmx -xmn...)
Par Quentin Ambard le lundi, mai 3 2010, 20:23 - Lien permanent Heap Java JVM Memory
avricot.com/blog/index.php?post/201
1/2
22/02/2012
generation is 1:3 -XX:NewSize - Size of the young generation at JVM init. Calculated automatically if you specify -XX:NewRatio -XX:MaxNewSize - The largest size the young generation can grow to (unlimited if this value is not specified at command line) -XX:SurvivorRatio : "old generation" called tenured generation, ratio, in %. For example, -XX:SurvivorRatio=6 sets the ratio between each survivor space and eden to be 1:6 (eden is where new objects are created) -XX:MinHeapFreeRatio: default is 40%. JVM will allocate memory to always have as minimum 40% of free memory. When -Xmx = -Xms, it's useless. -XX:MaxHeapFreeRatio: default is 70%. The same as Min, to avoid unecessary memory allocation.
More informationabout Sun HotSpot GC tuning here (http://java.sun.com/docs/hotspot/gc5.0/gc_tuning_5.html) and general gc tuning here (http://www.petefreitag.com/articles/gctuning/) At this point, we get a problem. In a multithread application, object can be created at the same time. Thread could try to write data into the same heap location at the same time. To avoid this problem, we allow each thread to have a private piece into the eden space. jdk 1.5> uses dynamic sizing algorithm, specific for each thread. (otherwise, parameter such as -XX:UseTLAB or -XX:TLABSize can be used to tune this parameter)
A nice gotcha...
Major collection don't run until tenured is full. This mean that using -Xmx1024, current heap could be 750MB with 500MB of "dead" object. If the JVM is idle, it could stay like that during a very long time => wasting 500MB or RAM for an idle JVM ! More informations about GC memory & monitoring here (http://gfx.developpez.com/tutoriel/java/gc/) You should also read this awesome slideshare from Filip Hanik, Covalent (http://www.slideshare.net/gengmao/inside-the-jvm-memory-management-andtroubleshooting) (gotcha, etc... most of this informations come from this slides)
Commentaires
1. Le mardi, octobre 4 2011, 20:49 par Renato M Thanks, you is the man...
avricot.com/blog/index.php?post/201
2/2