首页 > 编程语言 > 详细

Java运行时数据区域详解

时间:2021-06-20 23:03:21      阅读:23      评论:0      收藏:0      [点我收藏+]

 

JVM运行时数据区域(Run-Time Data Areas)包括以下几部分:

技术分享图片

1.程序计数器(The PC Register

2. Java虚拟机栈(Java Virtual Machine Stacks

每一个JVM线程都有一个Java虚拟机栈,当线程被创建的时候该虚拟机栈就会被一起创建。虚拟机栈描述的是Java方法执行的内存模型:每个方法在执行的同时都会创建一个栈帧(Stack Frame)。每一个方法从调用直至执行完成的过程,就对应着一个栈帧在虚拟机栈中入栈到出栈的过程。栈帧存储的信息包括:

局部变量表(Local Variable Table

操作数栈(Operand Stack

动态链接(Dynamic Linking

方法返回地址(Return Address

3. Heap

Head用来在运行时分配classarrays实例。class的实例只会被GCGarbage Collector)回收。

Heap分为以下几个区域:

Young Generation(年轻代)

Old Generation(老生代)

Permanent Generation(永久代)

4. Method Area

5.运行时常量池(Run-Time Constant Pool

运行时常量池(Runtime Constant Pool)包括:

numeric literals

string literals

class references

field references

method references

Constant Pool 包含以下的类型:

Integer

A 4 byte int constant

Long

An 8 byte long constant

Float

A 4 byte float constant

Double

A 8 byte double constant

String

A String constant that points at another Utf8 entry in the constant pool which contains the actual bytes

Utf8

A stream of bytes representing a Utf8 encoded sequence of characters

Class

A Class constant that points at another Utf8 entry in the constant pool which contains the fully qualified class name in the internal JVM format (this is used by the dynamic linking process)

NameAndType

A colon separated pair of values each pointing at other entries in the constant pool. The first value (before the colon) points at a Utf8 string entry that is the method or field name. The second value points at a Utf8 entry that represents the type, in the case of a field this is the fully qualified class name, in the case of a method this is a list of fully qualified class names one per parameter.

FieldRef,

MethodRef,

InterfaceMethodRef

A dot separated pair of values each pointing at other entries in the constant pool. The first value (before the dot) points at a Class entry. The second value points at a NameAndType entry.

 6. 本地方法栈(Native Method Stacks

Java 8起,Method Area被替换成MetaSpace.

Java运行时数据区域详解

原文:https://www.cnblogs.com/xifengcoder/p/14907582.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!