Java 内存模型学习笔记
时间:2019-05-04 14:07:51
收藏:0
阅读:145
1、Java类
public class Math { public static final Integer CONSTANT = 666; public int math(){ int a = 1; int b = 2; int c = (a+b) * 10; return c; } public static void main(String[] args) { Math math = new Math(); math.math(); } }
生成字节码文件 javac Math.java
2、反汇编字节码文件 javap -c Main.class
程序计数器: 程序要执行的下一行地址指针,线程独有。
操作数栈: 数据中转内存
动态链接:
方法出口:
方法区: JDK8之前叫永久代,JDK8之后叫元空间。存放静态变量+常量+类元信息(Math.class类元信息)
本地方法:
本地方法栈:
堆结构
内存溢出 OOM
原文:https://www.cnblogs.com/linlf03/p/10806123.html
评论(0)