Vít Jouda
https://www.digitalocean.com/community/tutorials/java-jvm-memory-model-memory-management-in-java
https://www.freecodecamp.org/news/garbage-collection-in-java-what-is-gc-and-how-it-works-in-the-jvm/
https://www.baeldung.com/java-gc-cyclic-references#tracing-gcs
Thread
System Class
Local variable
JNI
Others
IntelliJ Idea Profiler
Visual VM
Memory Analyzer Tool
...
-XX:NativeMemoryTracking
summary
detail
malloc arena
glibc
performance optimization
may not return to OS
defaults to 8x CPU core #
jemalloc
-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath="/dump"
does not work for system level OOMKilled
PreStop hook
terminationGracePeriodSeconds
manually
/dump
emptyDir volume
created when pod is first assigned to a node
removed once the pod is removed
OOM Kill
pod is not evicted
RestartPolicy
kubectl describe - Last State
jmap
needs JDK container image
jmap -dump:live,format=b,file=/dump/dump.hprof 1
jattach
jattach 1 dumpheap /dump/dump.hprof
gzip -k dump.hprof
kubectl cp --retries=10 -c {container} {namespace}/{pod name}:/dump/dump.hprof.gz ./dump.hprof.gz
Heapdump is a "stop the world" event!