auto commit
|
@ -31,7 +31,7 @@
|
|||
|
||||
# 一、运行时数据区域
|
||||
|
||||
<div align="center"> <img src="pics/11548742157520.gif" width="450"/> </div><br>
|
||||
<div align="center"> <img src="pics/b01e12b7-6cfc-485b-a03e-a575e6f7b773.jpg"/> </div><br>
|
||||
|
||||
## 程序计数器
|
||||
|
||||
|
@ -41,7 +41,7 @@
|
|||
|
||||
每个 Java 方法在执行的同时会创建一个栈帧用于存储局部变量表、操作数栈、常量池引用等信息。从方法调用直至执行完成的过程,就对应着一个栈帧在 Java 虚拟机栈中入栈和出栈的过程。
|
||||
|
||||
<div align="center"> <img src="pics/11548741556940.gif" width="500"/> </div><br>
|
||||
<div align="center"> <img src="pics/ff5b89ac-798e-4fbc-b0ce-da2fc2358570.jpg"/> </div><br>
|
||||
|
||||
可以通过 -Xss 这个虚拟机参数来指定每个线程的 Java 虚拟机栈内存大小:
|
||||
|
||||
|
@ -60,8 +60,7 @@ java -Xss512M HackTheJava
|
|||
|
||||
本地方法一般是用其它语言(C、C++ 或汇编语言等)编写的,并且被编译为基于本机硬件和操作系统的程序,对待这些方法需要特别处理。
|
||||
|
||||
|
||||
<div align="center"> <img src="pics/11548742010310.gif"/> </div><br>
|
||||
<div align="center"> <img src="pics/3034859c-eb5a-402b-b65a-974dcc0c4a46.png"/> </div><br>
|
||||
|
||||
## 堆
|
||||
|
||||
|
@ -141,7 +140,7 @@ Java 虚拟机使用该算法来判断对象是否可被回收,在 Java 中 GC
|
|||
- 方法区中类静态属性引用的对象
|
||||
- 方法区中的常量引用的对象
|
||||
|
||||
<div align="center"> <img src="pics/11548742505541.gif"/> </div><br>
|
||||
<div align="center"> <img src="pics/6dd28bfc-6ef7-47cb-af50-a681ebc1bbaa.png"/> </div><br>
|
||||
|
||||
### 3. 方法区的回收
|
||||
|
||||
|
@ -221,7 +220,7 @@ obj = null;
|
|||
|
||||
### 1. 标记 - 清除
|
||||
|
||||
<div align="center"> <img src="pics/11548743021625.gif"/> </div><br>
|
||||
<div align="center"> <img src="pics/3fb6e997-0fc9-4178-a691-5907b67bbeae.png"/> </div><br>
|
||||
|
||||
标记要回收的对象,然后清除。
|
||||
|
||||
|
@ -232,13 +231,13 @@ obj = null;
|
|||
|
||||
### 2. 标记 - 整理
|
||||
|
||||
<div align="center"> <img src="pics/11548743193273.gif"/> </div><br>
|
||||
<div align="center"> <img src="pics/fb14b808-734c-4634-9c87-e598b1937996.png"/> </div><br>
|
||||
|
||||
让所有存活的对象都向一端移动,然后直接清理掉端边界以外的内存。
|
||||
|
||||
### 3. 复制
|
||||
|
||||
<div align="center"> <img src="pics/11548743457272.gif"/> </div><br>
|
||||
<div align="center"> <img src="pics/3f04455c-f4ac-4038-a69f-21df133389e1.png"/> </div><br>
|
||||
|
||||
将内存划分为大小相等的两块,每次只使用其中一块,当这一块内存用完了就将还存活的对象复制到另一块上面,然后再把使用过的内存空间进行一次清理。
|
||||
|
||||
|
@ -440,7 +439,7 @@ G1 把堆划分成多个大小相等的独立区域(Region),新生代和
|
|||
|
||||
## 类的生命周期
|
||||
|
||||
<div align="center"> <img src="pics/11548744140733.gif"/> </div><br>
|
||||
<div align="center"> <img src="pics/303873db-0d11-4683-a43c-f319b7aef2b6.jpg"/> </div><br>
|
||||
|
||||
包括以下 7 个阶段:
|
||||
|
||||
|
|
BIN
docs/notes/pics/3034859c-eb5a-402b-b65a-974dcc0c4a46.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
docs/notes/pics/303873db-0d11-4683-a43c-f319b7aef2b6.jpg
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
docs/notes/pics/3f04455c-f4ac-4038-a69f-21df133389e1.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
docs/notes/pics/3fb6e997-0fc9-4178-a691-5907b67bbeae.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
docs/notes/pics/6dd28bfc-6ef7-47cb-af50-a681ebc1bbaa.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
docs/notes/pics/b01e12b7-6cfc-485b-a03e-a575e6f7b773.jpg
Normal file
After Width: | Height: | Size: 64 KiB |
BIN
docs/notes/pics/fb14b808-734c-4634-9c87-e598b1937996.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
docs/notes/pics/ff5b89ac-798e-4fbc-b0ce-da2fc2358570.jpg
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
docs/pics/3034859c-eb5a-402b-b65a-974dcc0c4a46.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
docs/pics/303873db-0d11-4683-a43c-f319b7aef2b6.jpg
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
docs/pics/3f04455c-f4ac-4038-a69f-21df133389e1.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
docs/pics/3fb6e997-0fc9-4178-a691-5907b67bbeae.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
docs/pics/6dd28bfc-6ef7-47cb-af50-a681ebc1bbaa.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
docs/pics/b01e12b7-6cfc-485b-a03e-a575e6f7b773.jpg
Normal file
After Width: | Height: | Size: 64 KiB |
BIN
docs/pics/fb14b808-734c-4634-9c87-e598b1937996.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
docs/pics/ff5b89ac-798e-4fbc-b0ce-da2fc2358570.jpg
Normal file
After Width: | Height: | Size: 22 KiB |