Java开发那些事Java虚拟机那些事JVM

java 虚拟机的运行时数据区

2020-07-28  本文已影响0人  逗逼程序员

Java 虚拟机定义了若干种程序运行期会使用到的运行时数据区,其中有一些会随着虚拟机的启动而创建,随着虚拟机的推出而销毁,另外一些则是与线程一一对应的,这些与线程对应的数据区域会随着线程的开始和结束而创建和销毁。

  1. Program counter(pc) Register
  2. jvm stacks
  3. heap memory
  4. method area
  5. run-time constant pool
  6. native method stacks

这些区域可以宽泛的分为两大类:

1、每个线程单独管理-随着线程启动而初始化

2、所有线程共享-随着jvm启动而初始化

Program Counter (PC) Register

That is like a pointer to the current instruction in sequence of instructions in a program. If the current executing method is ‘native’, then the value of program counter register will be undefined.

就像在程序中的指令序列中指向当前指令的指针一样。 如果当前执行方法是“native”,则程序计数器寄存器的值undefined。

Java Virtual Machine Stacks

JVM stacks are used to store Java virtual machine frames. JVM will not do any manipulation directly with the stacks and they are only storage units for frames.

Heap Memory

Heap data area is used to store objects of classes and arrays. Heap memory is common and shared across multiple threads. This is where the garbage collector comes into picture

Method Area

Method area is created at JVM startup and shared among all the threads.

Run-time Constant Pool

Run-time constant pool is created out of the method area and it is created by JVM when a class or interface is created.

JVM Run-time Data Areas
上一篇下一篇

猜你喜欢

热点阅读