How JVM and Java Memory Management Works — Summary

Photo by simon peel on Unsplash

What is JVM?

  • JVM (Java Virtual Machine) is a part of JRE (Java Runtime Environment).
    JRE is a set of components to create and run a Java application.
  • Java code is compiled into Java byte code.
    JVM converts Java byte code into machine language.
  • JVM provides a runtime environment for Java code / apps (an instance).
  • JVM is also responsible for allocating memory space.
JVM Architecture Diagram — https://www.guru99.com/java-virtual-machine-jvm.html

JIT (Just In Time Compiler)

  • compiles parts of byte code with similar functionality to reduce time for compilation
  • compiler here ->JVM’s instructions->a specific CPU’s instruction

JNI (Java Native Interface)

  • framework provides interface to communicate with another app written in another language (C, C++, Assembly, etc.)
  • Java uses JNI to send output to the console or interact with OS libs.

Java Memory Management

Method Area
- a fully qualified name of a type (for ex. String)
- the type’s modifiers
- type’s direct superclass name
- type’s super interfaces

https://www.javatpoint.com/memory-management-in-java

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Nil Seri

Nil Seri

777 Followers

I would love to change the world, but they won’t give me the source code | coding 👩🏼‍💻 | coffee ☕️ | jazz 🎷 | anime 🐲 | books 📚 | drawing 🎨