Thursday 19 June 2014

JAVA MEMORY MANAGEMENT

JAVA MEMORY MANAGEMENT

Low Latency -  One fast answer
High Throughput – All answers as fast as possible
JVM – Write once, run anywhere




Minor GC – moves the live objects from Eden space to Survivor spaces. If the objects are old enough then they are promoted to Old Generation space.




TenuringThreshold -Number of times the object has been copied between Survivor spaces. Default 7





Avoid large object allocations – which may directly go in Old Gen pace


The Objects will be placed in Finalizer queue and the queue will not necessary run everytime a GC cycle runs.





CMS – is good and runs currently along with application threads
No Compaction of data– we have to use free list and has fragmentation of heap




When Minor GC runs, it will free-up the space in Eden and Survivor1 and copies the live copies to Survivor2.



It stores as logically continuous area then physically


When Minor GC, happens



After Minor GC completion





The Eden space and survivor is empty now, the remaining live objects are copied to other survivor space region and the live objects which are promoted are copied to Old Gen region.





JVM parameters in Java   - JVM option it can be divided into two parts:

1)    JVM Options that begin with -X are non-standard (thy are not guaranteed to be supported on all JVM implementations), and are subject to change without notice in subsequent releases of the JDK.
2)    JVM Options or parameters which are specified with -XX are not stable and are not recommended for casual use. These options are subject to change without notice also.


Stack size -> -Xss
Heap size -> -Xms[starting size] –Xmx[maximum size]



No comments:

Post a Comment