JVM Internals Demystified

83a8147c3c83c22e1e421c3420e768f9?s=47 hannelita
February 19, 2015

JVM Internals Demystified

Confoo 2015

83a8147c3c83c22e1e421c3420e768f9?s=128

hannelita

February 19, 2015
Tweet

Transcript

  1. 1.

    ༼ つ ◕_◕ ༽つ JVM Internals ༼ つ ◕_◕ ༽つ

    Demystified! ( ͡° ͜ ʖ ͡°) ༼ つ ◕_◕ ༽つ ༼ つ ◕_◕ ༽つ
  2. 2.

    What we will NOT see here • Pure JVM boring

    theory • Assembly fear stuff • 0xFF • 0100111
  3. 3.

    What we will see here • Why internals? • Method

    Area • Heap • Threads • Further reading • Funny Gifs and images!
  4. 4.
  5. 7.
  6. 16.

    Memory analyse • Help! Perm gem problems! • Search for

    memory leaks • Memory analyser tools • Understand how JVM works
  7. 18.
  8. 28.

    operation + operand add r1, r2 public int add(int r1,

    int r2) operation operators == parameters
  9. 34.
  10. 36.

    Each fake reference for each method is unique So JVM

    can replace the fake calls with true invokes.
  11. 41.

    Method Area JVM Class stuff Class stuff Class stuff Non-Heap

    Permanent Generation HEAP Permanent Generation object object object
  12. 42.

    Young gen JVM - The Heap HEAP Lol lol =

    new LOL(); lol object object object
  13. 43.

    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
  14. 44.

    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
  15. 45.

    Old gen Young generation JVM - The Heap HEAP object

    object Eden lol Survivor object Will be taken for GC
  16. 50.

    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
  17. 51.

    JVM - Sum up Program Counter Stack Frame Frame Frame

    Frame Heap Non-Heap Object instances Class Stuff/ Method Area Similar to Computer Architecture
  18. 55.

    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