Learn about JVM Internals in just 3 crisp slides. Deck talks about JVM Architecture, it's memory model and Garbage Collection process succinctly in 3 slides.
More than Just Lines on a Map: Best Practices for U.S Bike Routes
JVM internals in 3 slides
1. JVM Internals in 3 slides
Ram Lakshmanan
www.linkedin.com/in/ramlakshman/
OS Memory
Java Process Memory
Java Objects Heap
Others
Young
Old
Perm
2. JVM Architecture
Class Loader
Method Area
Heap
Stack
Native Stack
JIT Compiler
Garbage Collector
Native Libraries
Native Interface
Execution Engine
JVM Memory
*.class
Component
Description
Class Loader
Loads class to memory
MethodArea
Information about class, methods, fields
Heap
All Java objectshoused. Shared by all Threads.
Stack
State of one Java method invocation. Notshared by Threads.
Native *
Native Program ExecutionEnvironment
JIT Compiler
Dynamically compiles byte codes in native code at runtime
Garbage Collector
Reclaimsmemory
3. Memories
OS Memory
Java Process Memory
Java Objects Heap
Others
Young
Old
Permanent
-Xmx
-Xmn
-XX:MaxPermSize
Young-Newly created objects
Old-New objects that
survived one or more minor
GC promoted here
Perm–Classes, Methods &
Meta Data
What you observe in TOP
Java Process Size
32 bit size ~2GB
64 bit size
Elements
Description
Thread Stacks
Each thread has a separate memory space. Controlled by–Xss
Garbage Collection
Threads. Memory to store GC info
Code Generation
Converting byte code into native code
Socket Buffers
TCP Connections (Receive buffer ~37k, Send buffer ~25k)
JNI
JNI programs also allocate memory
4. Garbage Collection
Live Objects
Unreferenced Objects
# 1: Mark
•Iterate through all objects
•Mark the “reachable” objects.
# 2: Sweep
•Remove unreachable objects
•Automatic
•Identifying which objects are in use and which are not. Delete unused objects.
Before GC
After Marking
Sweep
Compaction
# 3: Compact
•Compact referenced objects
•Makes new allocation faster