Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
JVM Internals Demystified
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
hannelita
February 19, 2015
Technology
380
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
JVM Internals Demystified
Confoo 2015
hannelita
February 19, 2015
More Decks by hannelita
See All by hannelita
Java EE 8 - Future, Wishes and Predictions
hannelita
1
240
Eletrônica
hannelita
0
200
Cassandra Meetup
hannelita
0
87
Our Daily Graphs written in Ruby and Neo4j
hannelita
1
200
Wildfly em alta disponibilidade
hannelita
0
290
Helios - o backend pra Mobile que você precisava <3
hannelita
0
140
Neo4j - Dia a dia com grafos, Neo4j e Ruby
hannelita
1
180
Swift - uma fama repentina
hannelita
1
170
Curso relâmpago de eletrônica básica para desenvolvedores
hannelita
1
290
Other Decks in Technology
See All in Technology
Guerilla InnerSource in enterprises, during the AI hype
onenashev
PRO
0
150
本番に近いテストをもっと手軽に - Postmanで広がるAPIテストの世界 / Expanding the World of API Testing with Postman
yokawasa
1
240
深夜のクラウド懺悔室 1:29:300 or 1:0:0
kazzpapa3
0
120
AI時代に、プロダクトの数だけ積み上がる所有コストをどうエンジニアリングするか / Engineering the Cost of Ownership
kzkmaeda
0
940
Bet AI Day 2026丨バクラク Autopilot、業務システムの再設計
layerx
PRO
2
1.1k
Tab5をRubyで動くパソコンにする
kishima
1
150
AI活用の現在地、 ちゃんと見えてますか?/XPfest-2026
visional_engineering_and_design
0
130
AI時代におけるプロダクト横断勉強会の設計
zozotech
PRO
0
150
AndroidでHDRメディアを「壊さずに」扱う
chigichan24
0
380
Bet AI Day 2026丨Production-Ready AI Agents — エンタープライズの実務を任せるための設計と運用
layerx
PRO
3
2k
Sony-DroidKaigi2026
sony
1
310
どんな手を使っても絶対間に合わせるスケジューラ
asari194617
0
1.5k
Featured
See All Featured
The Curse of the Amulet
leimatthew05
2
14k
Building the Perfect Custom Keyboard
takai
2
860
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
430
Navigating Weather and Climate Data
rabernat
0
510
KATA
mclloyd
PRO
35
15k
Side Projects
sachag
455
43k
Skip the Path - Find Your Career Trail
mkilby
1
220
Joys of Absence: A Defence of Solitary Play
codingconduct
1
470
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
550
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.7k
Code Review Best Practice
trishagee
74
20k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Transcript
༼ つ ◕_◕ ༽つ JVM Internals ༼ つ ◕_◕ ༽つ
Demystified! ( ͡° ͜ ʖ ͡°) ༼ つ ◕_◕ ༽つ ༼ つ ◕_◕ ༽つ
What we will NOT see here • Pure JVM boring
theory • Assembly fear stuff • 0xFF • 0100111
What we will see here • Why internals? • Method
Area • Heap • Threads • Further reading • Funny Gifs and images!
Bonjour
Hi! I’m Hanneli São Paulo, Brazil
Hi! I’m Hanneli Meanwhile here in Canada
None
No advanced stuff Simplified way
If you understand computer architecture classes You understand JVM
Why do I Need to Understand Internals?
We live in a simplified era
All externalised
All externalised (Almost)Normal dressed developers (external)
Do I need internal details?
Developer showing internal details
Memory analyse • Help! Perm gem problems! • Search for
memory leaks • Memory analyser tools • Understand how JVM works
What’s the relation between: JVM Memory Bytecode Assembly Low Level
OpCode Operator Operation Java
None
How do I get started? • http://www.artima.com/insidejvm/ed2/jvmP.html
How do I get started?
JVM - Low level Assembly
I know how to write Java code
༼ つ ◕_◕ ༽つ classes ༼ つ ◕_◕ ༽つ
What happens when I invoke a method in Java
WAIT How many kinds of methods do you know?
2 types of methods Clazz.method(); object.method(); static instance
From Assembly classes: op code + operand operation + operand
operation + operand add r1, r2 public int add(int r1,
int r2) operation operators == parameters
Method calls in JVM static instance operation + operand operation
+ operand invokevirtual invokestatic
Where are the Operands? Special place
Where are the Operands? Real place
Symbolic place called pool
JVM keeps this fake references It’s a strategy to deal
with dynamic linking
While JVM does need the content of this fake box
(pool), it remais unresolved
Each fake reference for each method is unique
Each fake reference for each method is unique So JVM
can replace the fake calls with true invokes.
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
Code Cache Permanent Generation
Done? object
༼ つ ◕_◕ ༽つ object ༼ つ ◕_◕ ༽つ
Method Area JVM Class stuff Class stuff Class stuff Non-Heap
Permanent Generation HEAP Permanent Generation object object object
Young gen JVM - The Heap HEAP Lol lol =
new LOL(); lol object object object
JVM - The Heap HEAP Permanent Generation object object object
object object object object object object object object object object object object object Hey, Im’m heavy
JVM - The Heap HEAP Permanent Generation object object object
object object object object object object object object object object object object object Checks all the objects on the heap Garbage collector
Old gen Young generation JVM - The Heap HEAP object
object Eden lol Survivor object Will be taken for GC
Last step Where does my application run?
Last step public static void main(String[] args){ …}
༼ つ ◕_◕ ༽つ thread ༼ つ ◕_◕ ༽つ
JVM - Thread Thread Heap Non-Heap
JVM - Thread Thread Program Counter Stack Frame Frame Frame
Frame Frame Local variables [] Return Value Pointer to Method Area Pointer to Heap Area Operand Operand Operand Operand Stack
JVM - Sum up Program Counter Stack Frame Frame Frame
Frame Heap Non-Heap Object instances Class Stuff/ Method Area Similar to Computer Architecture
༼ つ ◕_◕ ༽つ JVM ༼ つ ◕_◕ ༽つ
( ͡° ͜ ʖ ͡°) JVM ( ͡° ͜ ʖ
͡°)
Thanks!! Questions? @hannelita
[email protected]
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