42

Java-100天知识进阶-JVM内存-知识铺(三)

 4 years ago
source link: https://studygolang.com/articles/24726
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

知识铺: 致力于打造轻知识点,持续更新每次的知识点较少,阅读不累。不占太多时间,不停的来唤醒你记忆深处的知识点。

Java内存模型(JMM)

JVM内存模式是JVM的内存分区

Java内存模式是一种虚拟机规范

1. Jvm内存按照运行时态及内存规范划分

aq6vYvZ.png!web

  1. Java内存区域

qInQruN.png!web

2.1 线程安全

rYB3QzJ.png!web

2.1.1 程序计数器

VfQVR3f.png!web

2.1.2 虚拟机栈

NZvUnyM.png!web

2.1.3 本地方法

URbqAj7.png!web

2.2 线程不安全

2.2.1 方法区

JrMvAfN.png!web

2.2.2 堆包含如下图

IR7Vbmn.png!web

2.2.3 堆内存划分

IZnqe2M.png!web

总结:

  1. 程序计算器是唯一不会 OOM区
  2. 堆是gc的主要场所
  3. 线程安全区: 虚拟机栈,本地方法,程序计数器
  4. 非线程安全区:方法区,堆
  5. 堆:划分为 Eden,From Survivor,To Survivor
  6. 堆:各区比例:8:1:1

本文由zshipu.com学习笔记或整理或转载,如有侵权请联系,必改之。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK