博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
to be assemble
阅读量:6614 次
发布时间:2019-06-24

本文共 3460 字,大约阅读时间需要 11 分钟。

Runtime Data Areas are the memory areas assigned when the JVM program runs on the OS. The runtime data areas can be divided into 6 areas. Of the six, one PC Register, JVM Stack, and Native Method Stack are created for one thread. Heap, Method Area, and Runtime Constant Pool are shared by all threads.

 

  • PC register: One PC (Program Counter) register exists for one thread, and is created when the thread starts. PC register has the address of a JVM instruction being executed now.
  • JVM stack: One JVM stack exists for one thread, and is created when the thread starts. It is a stack that saves the struct (Stack Frame). The JVM just pushes or pops the stack frame to the JVM stack. If any exception occurs, each line of the stack trace shown as a method such as printStackTrace() expresses one stack frame.

    −Stack frame: One stack frame is created whenever a method is executed in the JVM, and the stack frame is added to the JVM stack of the thread. When the method is ended, the stack frame is removed. Each stack frame has the reference for local variable array, Operand stack, and runtime constant pool of a class where the method being executed belongs. The size of local variable array and Operand stack is determined while compiling. Therefore, the size of stack frame is fixed according to the method.

    −Local variable array: It has an index starting from 0. 0 is the reference of a class instance where the method belongs. From 1, the parameters sent to the method are saved. After the method parameters, the local variables of the method are saved.

    −Operand stack: An actual workspace of a method. Each method exchanges data between the Operand stack and the local variable array, and pushes or pops other method invoke results. The necessary size of the Operand stack space can be determined during compiling. Therefore, the size of the Operand stack can also be determined during compiling.

     

    • Native method stack: A stack for native code written in a language other than Java. In other words, it is a stack used to execute C/C++ codes invoked through JNI (Java Native Interface). According to the language, a C stack or C++ stack is created.
    • Method area: The method area is shared by all threads, created when the JVM starts. It stores runtime constant pool, field and method information, static variable, and method bytecode for each of the classes and interfaces read by the JVM. The method area can be implemented in various formats by JVM vendor. Oracle Hotspot JVM calls it Permanent Area or Permanent Generation (PermGen). The garbage collection for the method area is optional for each JVM vendor.
    • Runtime constant pool: An area that corresponds to the constant_pool table in the class file format. This area is included in the method area; however, it plays the most core role in JVM operation. Therefore, the JVM specification separately describes its importance. As well as the constant of each class and interface, it contains all references for methods and fields. In short, when a method or field is referred to, the JVM searches the actual address of the method or field on the memory by using the runtime constant pool.
    • Heap: A space that stores instances or objects, and is a target of garbage collection. This space is most frequently mentioned when discussing issues such as JVM performance. JVM vendors can determine how to configure the heap or not to collect garbage.

转载于:https://www.cnblogs.com/grep/archive/2012/10/11/2720014.html

你可能感兴趣的文章
JS动画效果链接汇总
查看>>
知识点笔记
查看>>
陈云川的OPENLDAP系列
查看>>
P1197 [JSOI2008]星球大战
查看>>
urllib模块
查看>>
XML转义字符
查看>>
微信小程序之简单记账本开发记录(六)
查看>>
mysql设置字符集CHARACTER SET
查看>>
Perl完全自学手册图文教程
查看>>
python(5)字典
查看>>
wordpress拿WebShell
查看>>
脚本结构和执行
查看>>
warden创建容器的过程
查看>>
【c++】size_t 和 size_type的区别
查看>>
SpringBoot之浅析配置项解析(三)
查看>>
15.2. switchport trunk encapsulation dot1q 提示 invaild input at^marker.
查看>>
getline函数(精华版)
查看>>
互联网辅助代理IP软件的应用需守牢数据安全的“底线”
查看>>
快速排序及其优化
查看>>
程序猿生存指南-10 敲定工作
查看>>