Topics we should Cover
● JDK VS JRE vs JVM
● RunTime Data Areas
● Object memory representation
● Object array memory
Topics we should Cover
● JDK VS JRE vs JVM
● RunTime Data Areas
● Object memory representation
● Object array memory
JDK VS JRE vs JVM
Similarity
JVM, JRE and JDK are platform dependent because configuration of each OS differs.
But, Java is platform independent.
JVM (Java Virtual Machine)
● ~ is an abstract machine
● ~ is a specification that provides runtime environment in which java bytecode can be
executed.
● ~ are available for many hardware and software platforms.
JDK VS JRE vs JVM
The JVM performs following main tasks:
● Loads code
● Verifies code
● Executes code
● Provides runtime environment
JDK VS JRE vs JVM
JRE
● ~is an acronym for Java Runtime Environment.
● ~ is used to provide runtime environment.
● ~ is the implementation of JVM.
● ~ physically exists.
● ~ contains set of libraries + other files that JVM uses at runtime.
● ~ released and maintained by Sun Micro
JDK VS JRE vs JVM
JDK
● ~is an acronym for Java Development Kit.
● ~physically exists.
● ~ It includes:
+ Java Runtime Environment (JRE),
+ an interpreter/loader (Java),
+ a compiler (javac),
+ an archiver (jar),
+ a documentation generator (Javadoc) and other tools needed in
Java development.
JDK VS JRE vs JVM
In Depth JRE (How does JRE works)
JRE consists of the following components:
● Deployment technologies:
○ deployment, Java Web Start and Java Plug-in.
● User interface toolkits:
○ AWT, Swing, Java 2D, Accessibility, Image I/O, Print Service and
more.
● Integration libraries:
○ JDBC, IDL, JNDI, RMI etc
● Other base libraries:
○ I/O, i18, Beans, Math, Networking etc.
In Depth JRE (How does JRE works)
● Lang and util base libraries:
○ lang and util, management, versioning, zip, instrument, reflection,
Collections, Concurrency Utilities, Java Archive (JAR), Logging,
Preferences API, Ref Objects and Regular Expressions.
● Java Virtual Machine (JVM):
○ including Java HotSpot Client and Server Virtual Machines.
JVM Run-Time Data Areas
JVM Run-Time Data Areas
Individual Thread :
● Not Shared
● created when a new thread is created
● include program counter register, JVM Stack, and Native Method Stack
○ is used to control each execution of each thread
○ contains frames, throws StackOverFlow error when stack get full
○ is used to support native methods
JVM Run-Time Data Areas
Frame: a frame is pushed to the stack when a method is invoked
JVM Run-Time Data Areas
Shared by All Threads
All threads share Heap and Method Area
● Heap:
○ most frequently deal with area.
○ It stores arrays and objects, created when JVM starts up.
○ Garbage Collection works in this area.
● Method Area:
○ stores run-time constant pool, field and method data, methods and
constructors code。 
●
JVM Run-Time Data Areas
Shared by All Threads
All threads share Heap and Method Area
● Runtime Constant Pool:
○ ~is a per-class or per-interface run-time representation of the
constant_pool table in a class file.
○ contains several kinds of constants, ranging from numeric literals known at
compile-time to method and field references that must be resolved at
run-time.
Heap Details
java -Xms=1M -XmX=2M "Class Name"
java -Xss=512M "Class Name"

Java Memory Descreption

  • 1.
    Topics we shouldCover ● JDK VS JRE vs JVM ● RunTime Data Areas ● Object memory representation ● Object array memory
  • 2.
    Topics we shouldCover ● JDK VS JRE vs JVM ● RunTime Data Areas ● Object memory representation ● Object array memory
  • 3.
    JDK VS JREvs JVM Similarity JVM, JRE and JDK are platform dependent because configuration of each OS differs. But, Java is platform independent. JVM (Java Virtual Machine) ● ~ is an abstract machine ● ~ is a specification that provides runtime environment in which java bytecode can be executed. ● ~ are available for many hardware and software platforms.
  • 4.
    JDK VS JREvs JVM The JVM performs following main tasks: ● Loads code ● Verifies code ● Executes code ● Provides runtime environment
  • 5.
    JDK VS JREvs JVM JRE ● ~is an acronym for Java Runtime Environment. ● ~ is used to provide runtime environment. ● ~ is the implementation of JVM. ● ~ physically exists. ● ~ contains set of libraries + other files that JVM uses at runtime. ● ~ released and maintained by Sun Micro
  • 6.
    JDK VS JREvs JVM JDK ● ~is an acronym for Java Development Kit. ● ~physically exists. ● ~ It includes: + Java Runtime Environment (JRE), + an interpreter/loader (Java), + a compiler (javac), + an archiver (jar), + a documentation generator (Javadoc) and other tools needed in Java development.
  • 7.
    JDK VS JREvs JVM
  • 8.
    In Depth JRE(How does JRE works) JRE consists of the following components: ● Deployment technologies: ○ deployment, Java Web Start and Java Plug-in. ● User interface toolkits: ○ AWT, Swing, Java 2D, Accessibility, Image I/O, Print Service and more. ● Integration libraries: ○ JDBC, IDL, JNDI, RMI etc ● Other base libraries: ○ I/O, i18, Beans, Math, Networking etc.
  • 9.
    In Depth JRE(How does JRE works) ● Lang and util base libraries: ○ lang and util, management, versioning, zip, instrument, reflection, Collections, Concurrency Utilities, Java Archive (JAR), Logging, Preferences API, Ref Objects and Regular Expressions. ● Java Virtual Machine (JVM): ○ including Java HotSpot Client and Server Virtual Machines.
  • 14.
  • 15.
    JVM Run-Time DataAreas Individual Thread : ● Not Shared ● created when a new thread is created ● include program counter register, JVM Stack, and Native Method Stack ○ is used to control each execution of each thread ○ contains frames, throws StackOverFlow error when stack get full ○ is used to support native methods
  • 16.
    JVM Run-Time DataAreas Frame: a frame is pushed to the stack when a method is invoked
  • 17.
    JVM Run-Time DataAreas Shared by All Threads All threads share Heap and Method Area ● Heap: ○ most frequently deal with area. ○ It stores arrays and objects, created when JVM starts up. ○ Garbage Collection works in this area. ● Method Area: ○ stores run-time constant pool, field and method data, methods and constructors code。  ●
  • 18.
    JVM Run-Time DataAreas Shared by All Threads All threads share Heap and Method Area ● Runtime Constant Pool: ○ ~is a per-class or per-interface run-time representation of the constant_pool table in a class file. ○ contains several kinds of constants, ranging from numeric literals known at compile-time to method and field references that must be resolved at run-time.
  • 19.
  • 20.
    java -Xms=1M -XmX=2M"Class Name" java -Xss=512M "Class Name"