码迷,mamicode.com
首页 > 其他好文 > 详细

元空间和运行时常量池

时间:2020-10-31 01:53:14      阅读:25      评论:0      收藏:0      [点我收藏+]

标签:cat   时代   compile   cep   nta   col   row   field   clu   

元空间是方法区的实现

方法区是什么呢?

  从java虚拟机规范9里摘抄的

It stores per-class structures such as the run-time
constant pool, field and method data, and the code for methods and constructors,
including the special methods used in class and interface initialization and in
instance initialization 

包括了如下的几个部分

  1 运行时常量池

  2 字段和方法数据

  3 方法和构造方法的字节码

而关于运行时常量池

A run-time constant pool is a per-class or per-interface run-time representation
of the constant_pool table in a class file (§4.4). It 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. The run-time constant pool serves a
function similar to that of a symbol table for a conventional programming language,
although it contains a wider range of data than a typical symbol table.
Each run-time constant pool is allocated from the Java Virtual Machine‘s method
area (§2.5.4). The run-time constant pool for a class or interface is constructed
when the class or interface is created (§5.3) by the Java Virtual Machine.
The following exceptional condition is associated with the construction of the runtime constant pool for a class or interface:
? When creating a class or interface, if the construction of the run-time constant
pool requires more memory than can be made available in the method area of the
Java Virtual Machine, the Java Virtual Machine throws an OutOfMemoryError.
See §5 (Loading, Linking, and Initializing) for information about the construction of the
run-time constant pool.

翻译过来就是,运行时常量池是class文件里常量池的运行时代表(run-time representation) 实在不知道怎么翻译好,各位理解就行了。

numeric literals数字字面量。

method and field references that must be resolved at run-time 方法和字段的引用只有在运行时才能解析,很好理解不到jvm里没法知道代码所在地址

 

元空间和运行时常量池

标签:cat   时代   compile   cep   nta   col   row   field   clu   

原文地址:https://www.cnblogs.com/juniorMa/p/13901878.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!