JVM Internals Demystified
-
Upload
hanneli-tavante -
Category
Technology
-
view
278 -
download
0
Transcript of JVM Internals Demystified
What we will see here• Why internals?
• Method Area
• Heap
• Threads
• Further reading
• Funny Gifs and images!
No advanced stuffSimplified way
Started learning Java for Web AppsNever had looked at JVM
It was difficult to learn the internals(at least for me)
Memory analyse
• Help! Perm gem problems!
• Search for memory leaks
• Memory analyser tools
• Understand how JVM works
How do I get started?• http://www.artima.com/insidejvm/ed2/jvmP.html
Back to methods
Clazz.method(int a);
object.method(parameter);class Lol { public int myMethod(int a){ // } }
Class stuff
Method Area
JVM
Class stuff Class stuff Class stuff
Non-Heap
Permanent G
eneration
HEAPPerm
anent Generation
objectobject
object
JVM - The Heap
HEAP
Permanent G
eneration
object
object
objectobject
object
object
objectobject
object
object
objectobject
object
object
objectobject
Hey, Im’m heavy
JVM - The Heap
HEAP
Permanent G
eneration
object
object
objectobject
object
object
objectobject
object
object
objectobject
object
object
objectobject
Checks all the objects on the heap
Garbage collector
Old gen
Young generation
JVM - The Heap
HEAPobject object
Eden
lolSurvivor
object
Will be taken for GC
JVM - Thread
Thread
Program Counter Stack
Frame
Frame
Frame
Frame
Frame
Local variables []Return ValuePointer to Method AreaPointer to Heap Area
OperandOperandOperand
Operand Stack
JVM - Sum upProgram Counter Stack
Frame
Frame
Frame
Frame
Heap Non-Heap
Object instances Class Stuff/ Method Area
Similar to Computer
Architecture
References• http://www.artima.com/insidejvm/ed2/jvmP.html
• http://www.cubrid.org/blog/dev-platform/understanding-jvm-internals/
• http://architects.dzone.com/articles/understanding-jvm-internals
• http://www.ourdailycodes.com/2013/09/inside-java-jvm-memory-structure-2.html
• http://javarevisited.blogspot.ca/2011/04/garbage-collection-in-java.html
• http://www.slideshare.net/BalamuruganSoundararajan/invoke-dynamics
• http://www.javaworld.com/article/2076949/learn-java/how-the-java-virtual-machine-handles-method-invocation-and-return.html
• http://blog.jamesdbloom.com/JVMInternals.html#threads
• http://www.amazon.com.br/Java-Virtual-Machine-Definition-Verification-ebook/dp/B000V9G6QW/ref=sr_1_1?ie=UTF8&qid=1435028967&sr=8-1&keywords=java+virtual+machine