674 lines
30 KiB
Markdown
674 lines
30 KiB
Markdown
|
<!-- GFM-TOC -->
|
|||
|
* [<EFBFBD>ڴ<EFBFBD>ģ<EFBFBD><EFBFBD>](#<23>ڴ<EFBFBD>ģ<EFBFBD><C4A3>)
|
|||
|
* [1. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>](#1-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
|||
|
* [2. Java <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ջ](#2-java-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ջ)
|
|||
|
* [3. <20><><EFBFBD>ط<EFBFBD><D8B7><EFBFBD>ջ](#3-<2D><><EFBFBD>ط<EFBFBD><D8B7><EFBFBD>ջ)
|
|||
|
* [4. Java <20><>](#4-java-<2D><>)
|
|||
|
* [5. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>](#5-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
|||
|
* [6. <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>](#6-<2D><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
|||
|
* [7. ֱ<><D6B1><EFBFBD>ڴ<EFBFBD>](#7-ֱ<><D6B1><EFBFBD>ڴ<EFBFBD>)
|
|||
|
* [<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD>](#<23><><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD>)
|
|||
|
* [1. <20>ж<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>ɻ<EFBFBD><C9BB><EFBFBD>](#1-<2D>ж<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>ɻ<EFBFBD><C9BB><EFBFBD>)
|
|||
|
* [1.1 <20><><EFBFBD>ü<EFBFBD><C3BC><EFBFBD>](#11-<2D><><EFBFBD>ü<EFBFBD><C3BC><EFBFBD>)
|
|||
|
* [1.2 <20>ɴ<EFBFBD><C9B4><EFBFBD>](#12-<2D>ɴ<EFBFBD><C9B4><EFBFBD>)
|
|||
|
* [1.3 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>](#13-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
|||
|
* [1.3.1 ǿ<><C7BF><EFBFBD><EFBFBD>](#131-ǿ<><C7BF><EFBFBD><EFBFBD>)
|
|||
|
* [1.3.2 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>](#132-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
|||
|
* [1.3.3 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>](#133-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
|||
|
* [1.3.4 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>](#134-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
|||
|
* [1.3 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD>](#13-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD>)
|
|||
|
* [1.4 finalize()](#14-finalize)
|
|||
|
* [2. <20><><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><D5BC>㷨](#2-<2D><><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><D5BC>㷨)
|
|||
|
* [2.1 <20><><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD><EFBFBD>㷨](#21-<2D><><EFBFBD><EFBFBD>---<2D><><EFBFBD><EFBFBD><EFBFBD>㷨)
|
|||
|
* [2.2 <20><><EFBFBD><EFBFBD><EFBFBD>㷨](#22-<2D><><EFBFBD><EFBFBD><EFBFBD>㷨)
|
|||
|
* [2.3 <20><><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD><EFBFBD>㷨](#23-<2D><><EFBFBD><EFBFBD>---<2D><><EFBFBD><EFBFBD><EFBFBD>㷨)
|
|||
|
* [2.4 <20>ִ<EFBFBD><D6B4>ռ<EFBFBD><D5BC>㷨](#24-<2D>ִ<EFBFBD><D6B4>ռ<EFBFBD><D5BC>㷨)
|
|||
|
* [3. <20><><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><D5BC><EFBFBD>](#3-<2D><><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><D5BC><EFBFBD>)
|
|||
|
* [3.1 Serial <20>ռ<EFBFBD><D5BC><EFBFBD>](#31-serial-<2D>ռ<EFBFBD><D5BC><EFBFBD>)
|
|||
|
* [3.2 ParNew <20>ռ<EFBFBD><D5BC><EFBFBD>](#32-parnew-<2D>ռ<EFBFBD><D5BC><EFBFBD>)
|
|||
|
* [3.3 Parallel Scavenge <20>ռ<EFBFBD><D5BC><EFBFBD>](#33-parallel-scavenge-<2D>ռ<EFBFBD><D5BC><EFBFBD>)
|
|||
|
* [3.4 Serial Old <20>ռ<EFBFBD><D5BC><EFBFBD>](#34-serial-old-<2D>ռ<EFBFBD><D5BC><EFBFBD>)
|
|||
|
* [3.5 Parallel Old <20>ռ<EFBFBD><D5BC><EFBFBD>](#35-parallel-old-<2D>ռ<EFBFBD><D5BC><EFBFBD>)
|
|||
|
* [3.6 CMS <20>ռ<EFBFBD><D5BC><EFBFBD>](#36-cms-<2D>ռ<EFBFBD><D5BC><EFBFBD>)
|
|||
|
* [3.7 G1 <20>ռ<EFBFBD><D5BC><EFBFBD>](#37-g1-<2D>ռ<EFBFBD><D5BC><EFBFBD>)
|
|||
|
* [3.8 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD>ıȽ<C4B1>](#38-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD>ıȽ<C4B1>)
|
|||
|
* [4. <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ղ<EFBFBD><D5B2><EFBFBD>](#4-<2D>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ղ<EFBFBD><D5B2><EFBFBD>)
|
|||
|
* [4.1 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Eden <20><><EFBFBD><EFBFBD>](#41-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-eden-<2D><><EFBFBD><EFBFBD>)
|
|||
|
* [4.2 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD>ӽ<EFBFBD><D3BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>](#42-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD>ӽ<EFBFBD><D3BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
|||
|
* [4.3 <20><><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD>Ķ<EFBFBD><C4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>](#43-<2D><><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD>Ķ<EFBFBD><C4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
|||
|
* [4.4 <20><>̬<EFBFBD><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>](#44-<2D><>̬<EFBFBD><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>)
|
|||
|
* [4.5 <20>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD>䵣<EFBFBD><E4B5A3>](#45-<2D>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD>䵣<EFBFBD><E4B5A3>)
|
|||
|
* [4.6 Full GC <20>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>](#46-full-gc-<2D>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
|||
|
* [4.6.1 <20><><EFBFBD><EFBFBD> System.gc()](#461-<2D><><EFBFBD><EFBFBD>-systemgc)
|
|||
|
* [4.6.2 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ䲻<D5BC><E4B2BB>](#462-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ䲻<D5BC><E4B2BB>)
|
|||
|
* [4.6.3 <20>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD>䵣<EFBFBD><E4B5A3>ʧ<EFBFBD><CAA7>](#463-<2D>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD>䵣<EFBFBD><E4B5A3>ʧ<EFBFBD><CAA7>)
|
|||
|
* [4.6.4 JDK 1.7 <20><><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD>ô<EFBFBD><C3B4>ռ䲻<D5BC><E4B2BB>](#464-jdk-17-<2D><><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD>ô<EFBFBD><C3B4>ռ䲻<D5BC><E4B2BB>)
|
|||
|
* [4.6.5 Concurrent Mode Failure](#465-concurrent-mode-failure)
|
|||
|
* [<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ػ<EFBFBD><EFBFBD><EFBFBD>](#<23><><EFBFBD><EFBFBD><EFBFBD>ػ<EFBFBD><D8BB><EFBFBD>)
|
|||
|
* [1 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>](#1-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
|||
|
* [2. <20><><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>ʱ<EFBFBD><CAB1>](#2-<2D><><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>ʱ<EFBFBD><CAB1>)
|
|||
|
* [3. <20><><EFBFBD><EFBFBD><EFBFBD>ع<EFBFBD><D8B9><EFBFBD>](#3-<2D><><EFBFBD><EFBFBD><EFBFBD>ع<EFBFBD><D8B9><EFBFBD>)
|
|||
|
* [3.1 <20><><EFBFBD><EFBFBD>](#31-<2D><><EFBFBD><EFBFBD>)
|
|||
|
* [3.2 <20><>֤](#32-<2D><>֤)
|
|||
|
* [3.3 <><D7BC>](#33-<><D7BC>)
|
|||
|
* [3.4 <20><><EFBFBD><EFBFBD>](#34-<2D><><EFBFBD><EFBFBD>)
|
|||
|
* [3.5 <20><>ʼ<EFBFBD><CABC>](#35-<2D><>ʼ<EFBFBD><CABC>)
|
|||
|
* [4. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>](#4-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
|||
|
* [4.1 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>](#41-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
|||
|
* [4.2 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>](#42-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
|||
|
* [4.3 ˫<><CBAB>ί<EFBFBD><CEAF>ģ<EFBFBD><C4A3>](#43-˫<><CBAB>ί<EFBFBD><CEAF>ģ<EFBFBD><C4A3>)
|
|||
|
* [JVM <20><><EFBFBD><EFBFBD>](#jvm-<2D><><EFBFBD><EFBFBD>)
|
|||
|
* [GC <20>Ż<EFBFBD><C5BB><EFBFBD><EFBFBD><EFBFBD>](#gc-<2D>Ż<EFBFBD><C5BB><EFBFBD><EFBFBD><EFBFBD>)
|
|||
|
* [GC <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>](#gc-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
|||
|
<!-- GFM-TOC -->
|
|||
|
|
|||
|
# <20>ڴ<EFBFBD>ģ<EFBFBD><C4A3>
|
|||
|
|
|||
|
![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/dc695f48-4189-4fc7-b950-ed25f6c80f82.jpg)
|
|||
|
|
|||
|
ע<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>߳<EFBFBD>˽<EFBFBD>еģ<EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>̹߳<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ġ<EFBFBD>
|
|||
|
|
|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FBD><D6B4><EFBFBD><EFBFBD><EFBFBD>ɵĹ<C9B5><C4B9>̣<EFBFBD><CCA3>Ͷ<EFBFBD>Ӧ<EFBFBD><D3A6>һ<EFBFBD><D2BB>ջ֡<D5BB><D6A1> Java <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD>ջ<EFBFBD>ͳ<EFBFBD>ջ<EFBFBD>Ĺ<EFBFBD><C4B9>̡<EFBFBD>
|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׳<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><EFBFBD>
|
|||
|
|
|||
|
1. <20><><EFBFBD>߳<EFBFBD><DFB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD>ȳ<EFBFBD><C8B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD>׳<EFBFBD> StackOverflowError <20>쳣<EFBFBD><ECB3A3>
|
|||
|
2. ջ<><D5BB><EFBFBD>ж<EFBFBD>̬<EFBFBD><CCAC>չʱ<D5B9><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><DEB7><EFBFBD><EFBFBD>뵼<EFBFBD>㹻<EFBFBD>ڴ棬<DAB4><E6A3AC><EFBFBD>׳<EFBFBD> OutOfMemoryError <20>쳣<EFBFBD><ECB3A3>
|
|||
|
|
|||
|
## 3. <20><><EFBFBD>ط<EFBFBD><D8B7><EFBFBD>ջ
|
|||
|
|
|||
|
<EFBFBD><EFBFBD> Java <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD>ƣ<EFBFBD><C6A3><EFBFBD><EFBFBD><EFBFBD>֮<EFBFBD><D6AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD><D6BB><EFBFBD><EFBFBD><EFBFBD>DZ<EFBFBD><C7B1>ط<EFBFBD><D8B7><EFBFBD>ջΪ<D5BB><CEAA><EFBFBD>ط<EFBFBD><D8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
## 4. Java <20><>
|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ档
|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"GC <20><> "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Dz<EFBFBD><C7B2>÷ִ<C3B7><D6B4>ռ<EFBFBD><D5BC>㷨<EFBFBD><E3B7A8>Java <20>ѻ<EFBFBD><D1BB><EFBFBD><EFBFBD>Էֳɣ<D6B3><C9A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Էֳ<D4B7> Eden <20>ռ䡢From Survivor <20>ռ䡢To Survivor <20>ռ<EFBFBD><D5BC>ȣ<EFBFBD><C8A3><EFBFBD>
|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ棬<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD> -Xmx <20><> -Xms <20><><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD>̬<EFBFBD><CCAC>չ<EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̬<EFBFBD><CCAC>չʧ<D5B9>ܻ<EFBFBD><DCBB>׳<EFBFBD> OutOfMemoryError <20>쳣<EFBFBD><ECB3A3>
|
|||
|
|
|||
|
## 5. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݡ<EFBFBD>
|
|||
|
|
|||
|
<EFBFBD><EFBFBD> Java <20><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ棬<DAB4><E6A3AC><EFBFBD>ҿ<EFBFBD><D2BF>Զ<EFBFBD>̬<EFBFBD><CCAC>չ<EFBFBD><D5B9><EFBFBD><EFBFBD>̬<EFBFBD><CCAC>չʧ<D5B9><CAA7>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>׳<EFBFBD> OutOfMemoryError <20>쳣<EFBFBD><ECB3A3>
|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD><EFBFBD><EFBFBD>ҪĿ<EFBFBD><EFBFBD><EFBFBD>ǶԳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>صĻ<EFBFBD><EFBFBD>պͶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>أ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD>Ƚ<EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD>֣<EFBFBD>HotSpot <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ô<EFBFBD><C3B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ա<EFBFBD>
|
|||
|
|
|||
|
## 6. <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD>
|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>غ<EFBFBD><EFBFBD><EFBFBD>Class <20>ļ<EFBFBD><C4BC>еij<D0B5><C4B3><EFBFBD><EFBFBD>أ<EFBFBD><D8A3><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4>ű<EFBFBD><C5B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɵĸ<C9B5><C4B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD><C3A3>ͻᱻ<CDBB>ŵ<EFBFBD><C5B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>Ҳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ù<EFBFBD> String <20><><EFBFBD><EFBFBD> intern() <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µij<C2B5><C4B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
## 7. ֱ<><D6B1><EFBFBD>ڴ<EFBFBD>
|
|||
|
|
|||
|
<EFBFBD><EFBFBD> JDK 1.4 <20><><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD> NIO <20>࣬<EFBFBD><E0A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>ֻ<EFBFBD><D6BB><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD>Channel<65><6C><EFBFBD>뻺<EFBFBD><EBBBBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Buffer<65><72><EFBFBD><EFBFBD> I/O <20><>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9> Native <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD>ӷ<EFBFBD><D3B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ棬Ȼ<E6A3AC><C8BB>ͨ<EFBFBD><CDA8>һ<EFBFBD><D2BB><EFBFBD>洢<EFBFBD><E6B4A2> Java <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> DirectByteBuffer <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ý<EFBFBD><C3BD>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һЩ<D2BB><D0A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD>Ϊ<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|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Java <20>Ѻͷ<D1BA><CDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD>
|
|||
|
|
|||
|
## 1. <20>ж<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>ɻ<EFBFBD><C9BB><EFBFBD>
|
|||
|
|
|||
|
### 1.1 <20><><EFBFBD>ü<EFBFBD><C3BC><EFBFBD>
|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ü<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1<><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧЧʱ<D0A7><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1<><31>
|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD>ü<EFBFBD><EFBFBD><EFBFBD>Ϊ 0 <20>Ķ<EFBFBD><C4B6><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD><EFBFBD>ա<EFBFBD>
|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⣬<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD>ü<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD>Ϊ 0<><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD> GC <20>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD><EFBFBD><DEB7><EFBFBD><EFBFBD>ա<EFBFBD>
|
|||
|
|
|||
|
```java
|
|||
|
objA.instance = objB;
|
|||
|
objB.instance = objA;
|
|||
|
```
|
|||
|
|
|||
|
### 1.2 <20>ɴ<EFBFBD><C9B4><EFBFBD>
|
|||
|
|
|||
|
ͨ<EFBFBD><EFBFBD> GC Roots <20><>Ϊ<EFBFBD><CEAA>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܹ<EFBFBD><DCB9><EFBFBD><EFBFBD>ﵽ<EFBFBD>Ķ<EFBFBD><C4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƕ<EFBFBD><C7B6>ǿ<EFBFBD><C7BF>õģ<C3B5><C4A3><EFBFBD><EFBFBD>ɴ<EFBFBD><C9B4>Ķ<EFBFBD><C4B6><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD><EFBFBD>ա<EFBFBD>
|
|||
|
|
|||
|
GC Roots һ<><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>
|
|||
|
|
|||
|
1. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD><EFBFBD>õĶ<C3B5><C4B6><EFBFBD>
|
|||
|
2. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ྲ̬<E0BEB2><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õĶ<C3B5><C4B6><EFBFBD>
|
|||
|
3. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>еij<D0B5><C4B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õĶ<C3B5><C4B6><EFBFBD>
|
|||
|
4. <20><><EFBFBD>ط<EFBFBD><D8B7><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD><EFBFBD>õĶ<C3B5><C4B6><EFBFBD>
|
|||
|
|
|||
|
### 1.3 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ü<EFBFBD><EFBFBD><EFBFBD><EFBFBD>㷨<EFBFBD>ж϶<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD><EFBFBD>ɴ<EFBFBD><EFBFBD>Է<EFBFBD><EFBFBD><EFBFBD><EFBFBD>㷨<EFBFBD>ж϶<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD>ɴ<EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>롰<EFBFBD><EFBFBD><EFBFBD>á<EFBFBD><EFBFBD>йء<EFBFBD>
|
|||
|
|
|||
|
#### 1.3.1 ǿ<><C7BF><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
ֻҪǿ<EFBFBD><EFBFBD><EFBFBD>ô<EFBFBD><EFBFBD>ڣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õĶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
```java
|
|||
|
Object obj = new Object();
|
|||
|
```
|
|||
|
|
|||
|
#### 1.3.2 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
|
|||
|
<EFBFBD>DZ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֮ǰ<EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><EFBFBD>ա<EFBFBD>
|
|||
|
|
|||
|
```java
|
|||
|
Object obj = new Object();
|
|||
|
SoftReference<Object> sf = new SoftReference<Object>(obj);
|
|||
|
obj = null;
|
|||
|
sf.get();
|
|||
|
```
|
|||
|
|
|||
|
sf <20>Ƕ<EFBFBD> obj <20><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD>ͨ<EFBFBD><CDA8> sf.get() <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFB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>ݣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD>Щ<EFBFBD><EFBFBD><EFBFBD>ݡ<EFBFBD>
|
|||
|
|
|||
|
|
|||
|
#### 1.3.3 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
ֻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>浽<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֮ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>۵<EFBFBD>ǰ<EFBFBD>ڴ<EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD>㹻<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ᱻ<EFBFBD><EFBFBD><EFBFBD>ա<EFBFBD>
|
|||
|
|
|||
|
```java
|
|||
|
Object obj = new Object();
|
|||
|
WeakReference<Object> wf = new WeakReference<Object>(obj);
|
|||
|
obj = null;
|
|||
|
wf.get();
|
|||
|
wf.isEnQueued();
|
|||
|
```
|
|||
|
|
|||
|
#### 1.3.4 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
<EFBFBD>ֳ<EFBFBD>Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD>Ӱ<EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õĴ<EFBFBD><EFBFBD>ڣ<EFBFBD><EFBFBD><EFBFBD>ȫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>乹<EFBFBD><EFBFBD>Ӱ<EFBFBD>죬Ҳ<EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊһ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ù<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΨһĿ<EFBFBD>ľ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>յ<EFBFBD>һ<EFBFBD><EFBFBD>ϵͳ֪ͨ<EFBFBD><EFBFBD>
|
|||
|
|
|||
|
```java
|
|||
|
Object obj = new Object();
|
|||
|
PhantomReference<Object> pf = new PhantomReference<Object>(obj);
|
|||
|
obj=null;
|
|||
|
pf.get();
|
|||
|
pf.isEnQueued();
|
|||
|
```
|
|||
|
|
|||
|
### 1.3 <20><><EFBFBD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FBFBD><D0B2><EFBFBD><EFBFBD>ڸ<EFBFBD><DAB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>κ<EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD>
|
|||
|
2. <20><><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD> ClassLoader <20>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ա<EFBFBD>
|
|||
|
3. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6> java.lang.Class <20><><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>κεط<CEB5><D8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD>Ҳ<EFBFBD><D2B2><EFBFBD><EFBFBD><DEB7><EFBFBD><EFBFBD>κεط<CEB5>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʸ<EFBFBD><CAB8><EFBFBD><E0B7BD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD> -Xnoclassgc <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>ء<EFBFBD>
|
|||
|
|
|||
|
<EFBFBD>ڴ<EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>÷<EFBFBD><EFBFBD>䡢<EFBFBD><EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>CGLib <20><> ByteCode <20><><EFBFBD>ܡ<EFBFBD><DCA1><EFBFBD>̬<EFBFBD><CCAC><EFBFBD><EFBFBD> JSP <20>Լ<EFBFBD> OSGo <20><><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD> ClassLoader <20>ij<EFBFBD><C4B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߱<EFBFBD><DFB1><EFBFBD>ж<EFBFBD>ع<EFBFBD><D8B9>ܣ<EFBFBD><DCA3>Ա<EFBFBD>֤<EFBFBD><D6A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
### 1.4 finalize()
|
|||
|
|
|||
|
<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ö<EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>Ҫִ<EFBFBD><EFBFBD> finalize() <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ô<EFBFBD><C3B4><EFBFBD>п<EFBFBD><D0BF>ܿ<EFBFBD><DCBF><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD>ڸ÷<DAB8><C3B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>±<EFBFBD><C2B1><EFBFBD><EFBFBD>ã<EFBFBD><C3A3>Ӷ<EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD>Ծȡ<D4BE>
|
|||
|
|
|||
|
finalize() <20><><EFBFBD><EFBFBD> C++ <20><><EFBFBD>鹹<EFBFBD><E9B9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ر<EFBFBD><D8B1>ⲿ<EFBFBD><E2B2BF>Դ<EFBFBD>ȹ<EFBFBD><C8B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> try-finally <20>ȷ<EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĸ<EFBFBD><C4B8>ã<EFBFBD><C3A3><EFBFBD><EFBFBD>Ҹ÷<D2B8><C3B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4>۸߰<DBB8><DFB0><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD><EFBFBD><DEB7><EFBFBD>֤<EFBFBD><D6A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD>˳<EFBFBD><CBB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ò<EFBFBD>Ҫʹ<D2AA>á<EFBFBD>
|
|||
|
|
|||
|
## 2. <20><><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><D5BC>㷨
|
|||
|
|
|||
|
### 2.1 <20><><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD><EFBFBD>㷨
|
|||
|
|
|||
|
![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/a4248c4b-6c1d-4fb8-a557-86da92d3a294.jpg)
|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD>յĶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><EFBFBD>ǣ<EFBFBD>Ȼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD>㣺
|
|||
|
|
|||
|
1. <20><><EFBFBD>Ǻ<EFBFBD><C7BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD>ʶ<EFBFBD><CAB6><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
2. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƭ
|
|||
|
|
|||
|
֮<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>㷨<EFBFBD><EFBFBD><EFBFBD>ǻ<EFBFBD><EFBFBD>ڸ<EFBFBD><EFBFBD>㷨<EFBFBD><EFBFBD><EFBFBD>иĽ<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
### 2.2 <20><><EFBFBD><EFBFBD><EFBFBD>㷨
|
|||
|
|
|||
|
![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/e6b733ad-606d-4028-b3e8-83c3a73a3797.jpg)
|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD>ڴ滮<EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>С<EFBFBD><EFBFBD><EFBFBD>ȵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>飬ÿ<EFBFBD><EFBFBD>ֻʹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>飬<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˾ͽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ķ<EFB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FBFBD> Eden <20>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><D0A1> Survior <20>ռ䣬ÿ<E4A3AC><C3BF>ʹ<EFBFBD><CAB9> Eden <20>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB> Survivor<6F><72><EFBFBD>ڻ<EFBFBD><DABB><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD> Eden <20><> Survivor <20>л<EFBFBD><D0BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵĶ<C5B5><C4B6><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>Ը<EFBFBD><D4B8>Ƶ<EFBFBD><C6B5><EFBFBD>һ<EFBFBD><D2BB> Survivor <20>ռ<EFBFBD><D5BC>ϣ<EFBFBD><CFA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Eden <20><> Survivor<6F><72>HotSpot <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Eden <20><> Survivor <20>Ĵ<EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC>Ϊ 8:1<><31><EFBFBD><EFBFBD>֤<EFBFBD><D6A4><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʴﵽ 90 %<25><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>ж<EFBFBD><D0B6><EFBFBD> 10% <20>Ķ<EFBFBD><C4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEA3AC>ôһ<C3B4><D2BB> Survivor <20>ռ<EFBFBD><D5BC>Ͳ<EFBFBD><CDB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD><CBA3><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>з<EFBFBD><D0B7>䵣<EFBFBD><E4B5A3><EFBFBD><EFBFBD>Ҳ<EFBFBD><D2B2><EFBFBD>ǽ<EFBFBD><C7BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀռ䡣
|
|||
|
|
|||
|
### 2.3 <20><><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD><EFBFBD>㷨
|
|||
|
|
|||
|
![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/902b83ab-8054-4bd2-898f-9a4a0fe52830.jpg)
|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ķ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><EFBFBD><EFBFBD>Ȼ<EFBFBD><EFBFBD>ֱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˱߽<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ档
|
|||
|
|
|||
|
### 2.4 <20>ִ<EFBFBD><D6B4>ռ<EFBFBD><D5BC>㷨
|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>÷ִ<EFBFBD><EFBFBD>ռ<EFBFBD><EFBFBD>㷨<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܵļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><EFBFBD>㷨<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڽ<EFBFBD><EFBFBD>ڴ滮<EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD><EFBFBD>飬<EFBFBD><EFBFBD>ͬ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><EFBFBD>㷨<EFBFBD><EFBFBD>
|
|||
|
|
|||
|
һ<EFBFBD>㽫 Java <20>ѷ<EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
1. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>ã<EFBFBD><C3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>㷨
|
|||
|
2. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>ã<EFBFBD><C3A3><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD> <20>㷨<EFBFBD><E3B7A8>
|
|||
|
|
|||
|
## 3. <20><><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><D5BC><EFBFBD>
|
|||
|
|
|||
|
![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/c625baa0-dde6-449e-93df-c3a67f2f430f.jpg)
|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> HotSpot <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD> 7 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߱<EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>á<EFBFBD>
|
|||
|
|
|||
|
### 3.1 Serial <20>ռ<EFBFBD><D5BC><EFBFBD>
|
|||
|
|
|||
|
![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/22fda4ae-4dd5-489d-ab10-9ebfdad22ae0.jpg)
|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD>ǵ<EFBFBD><EFBFBD>̵߳<EFBFBD><EFBFBD>ռ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ζ<EFBFBD><EFBFBD>ֻ<EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD>߳̽<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD>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ACB8>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD>ռ<EFBFBD><D5BC><EFBFBD>ʮ<EFBFBD><CAAE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><D7B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD>Կ<EFBFBD><D4BF><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>ٶ<EFBFBD><D9B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>ֻҪ<D6BB><D2AA><EFBFBD><EFBFBD>̫Ƶ<CCAB><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD>ǿ<EFBFBD><C7BF>Խ<EFBFBD><D4BD>ܵġ<DCB5>
|
|||
|
|
|||
|
### 3.2 ParNew <20>ռ<EFBFBD><D5BC><EFBFBD>
|
|||
|
|
|||
|
![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/81538cd5-1bcf-4e31-86e5-e198df1e013b.jpg)
|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD> Serial <20>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD>Ķ<EFBFBD><C4B6>̰߳汾<CCB0><E6B1BE>
|
|||
|
|
|||
|
<EFBFBD><EFBFBD> Server ģʽ<C4A3>µ<EFBFBD><C2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD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FBFBD><EFBFBD>Լ<EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><D0A1> -XX:GCTimeRatio <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵΪ<D6B5><CEAA><EFBFBD><EFBFBD> 0 <20><>С<EFBFBD><D0A1> 100 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><D5BC><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ձ<EFBFBD><D5B1><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>½<EFBFBD><C2BD><EFBFBD>
|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD>ṩ<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> -XX:+UseAdaptiveSizePolicy<63><79><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<E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1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD>ʽ<EFBFBD><CABD>Ϊ GC <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD>ĵ<EFBFBD><C4B5>ڲ<EFBFBD><DAB2>ԣ<EFBFBD>GC Ergonomics<63><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>Ҳ<EFBFBD><D2B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ParNew <20>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
### 3.4 Serial Old <20>ռ<EFBFBD><D5BC><EFBFBD>
|
|||
|
|
|||
|
![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/08f32fd3-f736-4a67-81ca-295b2a7972f2.jpg)
|
|||
|
|
|||
|
Serial Old <20><> Serial <20>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>汾<EFBFBD><E6B1BE>Ҳ<EFBFBD>Ǹ<EFBFBD> Client ģʽ<C4A3>µ<EFBFBD><C2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>á<EFBFBD><C3A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Server ģʽ<C4A3>£<EFBFBD><C2A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;<EFBFBD><CDBE>
|
|||
|
|
|||
|
1. <20><> JDK 1.5 <20>Լ<EFBFBD>֮ǰ<D6AE>汾<EFBFBD><E6B1BE>Parallel Old <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Parallel Scavenge <20>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>á<EFBFBD>
|
|||
|
2. <20><>Ϊ CMS <20>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD>ĺ<EFBFBD><C4BA><EFBFBD>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD><EFBFBD>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD><EFBFBD> Concurrent Mode Failure ʱʹ<CAB1>á<EFBFBD>
|
|||
|
|
|||
|
### 3.5 Parallel Old <20>ռ<EFBFBD><D5BC><EFBFBD>
|
|||
|
|
|||
|
![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/278fe431-af88-4a95-a895-9c3b80117de3.jpg)
|
|||
|
|
|||
|
<EFBFBD><EFBFBD> Parallel Scavenge <20>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>汾<EFBFBD><E6B1BE>
|
|||
|
|
|||
|
<EFBFBD><EFBFBD>ע<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD> CPU <20><>Դ<EFBFBD><D4B4><EFBFBD>еij<D0B5><C4B3>ϣ<EFBFBD><CFA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȿ<EFBFBD><C8BF><EFBFBD> Parallel Scavenge <20><> Parallel Old <20>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
### 3.6 CMS <20>ռ<EFBFBD><D5BC><EFBFBD>
|
|||
|
|
|||
|
![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/62e77997-6957-4b68-8d12-bfd609bb2c68.jpg)
|
|||
|
|
|||
|
CMS<EFBFBD><EFBFBD>Concurrent Mark Sweep<65><70><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Mark Sweep <20><><EFBFBD><EFBFBD>֪<EFBFBD><D6AA><EFBFBD><EFBFBD><EFBFBD>ǻ<EFBFBD><C7BB><EFBFBD> <20><><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD> <20>㷨ʵ<E3B7A8>ֵġ<D6B5>
|
|||
|
|
|||
|
<EFBFBD>ص㣺<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD>١<EFBFBD>
|
|||
|
|
|||
|
<EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĸ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>̣<EFBFBD>
|
|||
|
|
|||
|
1. <20><>ʼ<EFBFBD><CABC><EFBFBD>ǣ<EFBFBD><C7A3><EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD>DZ<EFBFBD><C7B1><EFBFBD>һ<EFBFBD><D2BB> GC Roots <20><>ֱ<EFBFBD>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ķ<EFBFBD><C4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٶȺܿ죬<DCBF><ECA3AC>Ҫͣ<D2AA>١<EFBFBD>
|
|||
|
2. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǣ<EFBFBD><C7A3><EFBFBD><EFBFBD><EFBFBD> GC Roots Tracing <20>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ȣ<D6B1>JDK 1.5 Ĭ<><C4AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¸<EFBFBD>ֵΪ 68<36><38>Ҳ<EFBFBD><D2B2><EFBFBD>ǵ<EFBFBD><C7B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD> 68% <20>Ŀռ<C4BF>֮<EFBFBD><D6AE><EFBFBD>ᴥ<EFBFBD><E1B4A5><EFBFBD>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD>õ<EFBFBD>̫<EFBFBD>ߣ<EFBFBD><DFA3><EFBFBD><EFBFBD>¸<EFBFBD><C2B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><DEB7><EFBFBD><EFBFBD>棬<EFBFBD><E6A3AC>ô<EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> Concurrent Mode Failure<72><65><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD> Serial Old <20>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>½<EFBFBD><C2BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><D5BC><EFBFBD>
|
|||
|
|
|||
|
3. <20><><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD><EFBFBD>㷨<EFBFBD><E3B7A8><EFBFBD>µĿռ<C4BF><D5BC><EFBFBD>Ƭ<EFBFBD><C6AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD><DCB4>鷳<EFBFBD><E9B7B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD>ʣ<EFBFBD>࣬<EFBFBD><E0A3AC><EFBFBD><EFBFBD><DEB7>ҵ<EFBFBD><D2B5>㹻<EFBFBD><E3B9BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>䵱ǰ<E4B5B1><C7B0><EFBFBD><EFBFBD><F3A3ACB2>ò<EFBFBD><C3B2><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>һ<EFBFBD><D2BB> Full GC<47><43>
|
|||
|
|
|||
|
### 3.7 G1 <20>ռ<EFBFBD><D5BC><EFBFBD>
|
|||
|
|
|||
|
![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/f99ee771-c56f-47fb-9148-c0036695b5fe.jpg)
|
|||
|
|
|||
|
G1<EFBFBD><EFBFBD>Garbage-First<73><74><EFBFBD>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD>ǵ<EFBFBD><C7B5><EFBFBD><EFBFBD>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>չ<EFBFBD><D5B9>ǰ<EFBFBD>صijɹ<C4B3>֮һ<D6AE><D2B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FBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD>кܴ<D0BA><DCB4><EFBFBD><EFBFBD>𣬽<EFBFBD><F0A3ACBD><EFBFBD><EFBFBD><EFBFBD> Java <20>ѻ<EFBFBD><D1BB><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><D0A1><EFBFBD>ȵĶ<C8B5><C4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Region<6F><6E><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĸ<EFBFBD><C4B8><EFBFBD><EEA3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD><CBA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD> Region<6F><6E><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>ϡ<EFBFBD>
|
|||
|
|
|||
|
֮<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԥ<EFBFBD><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<EFBFBD><E4A3AC><EFBFBD>Ȼ<EFBFBD><C8BB>ռ<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Region<6F><6E><EFBFBD><EFBFBD>Ҳ<EFBFBD><D2B2><EFBFBD><EFBFBD> Garbage-First <20><><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD>ɣ<EFBFBD><C9A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9> Region <20><><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4>ռ<EFBFBD><D5BC>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD><C8BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>շ<EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD>֤<EFBFBD><D6A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>ڿ<EFBFBD><DABF>Ի<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>ܸߵ<DCB8><DFB5>ռ<EFBFBD>Ч<EFBFBD>ʡ<EFBFBD>
|
|||
|
|
|||
|
Region <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǹ<EFBFBD><C7B9><EFBFBD><EFBFBD>ģ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD><C4B3> Region <20>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Java <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ķ<E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><EFBFBD>һ<EFBFBD><D2BB> Write Barrier <20><>ʱ<EFBFBD>ж<EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Reference <20><><EFBFBD>õĶ<C3B5><C4B6><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ڲ<EFBFBD>ͬ<EFBFBD><CDAC> Region ֮<>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǣ<EFBFBD><C7A3><EFBFBD>ͨ<EFBFBD><CDA8> CardTable <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Region <20><> Remembered Set ֮<>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD> GC <20><><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>ö<EFBFBD>ٷ<EFBFBD>Χ<EFBFBD>м<EFBFBD><D0BC><EFBFBD> Remembered Set <20><><EFBFBD>ɱ<EFBFBD>֤<EFBFBD><D6A4><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB>ɨ<EFBFBD><C9A8>Ҳ<EFBFBD><D2B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>©<EFBFBD><C2A9>
|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ά<EFBFBD><EFBFBD> Remembered Set <20>IJ<EFBFBD><C4B2><EFBFBD><EFBFBD><EFBFBD>G1 <20>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¿ɻ<C2BF><C9BB><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>裺
|
|||
|
|
|||
|
1. <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>
|
|||
|
2. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
3. <20><><EFBFBD>ձ<EFBFBD><D5B1>ǣ<EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD><DABC><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>±<EFBFBD><C2B1>Dz<EFBFBD><C7B2><EFBFBD><EFBFBD>䶯<EFBFBD><E4B6AF><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ֱ<EFBFBD><D6B1>Ǽ<EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>仯<EFBFBD><E4BBAF>¼<EFBFBD><C2BC><EFBFBD>̵߳<DFB3> Remembered Set Logs <20><><EFBFBD>棬<EFBFBD><E6A3AC><EFBFBD>ձ<EFBFBD><D5B1>ǽ<C7BD><D7B6><EFBFBD>Ҫ<EFBFBD><D2AA> Remembered Set Logs <20><><EFBFBD><EFBFBD><EFBFBD>ݺϲ<DDBA><CFB2><EFBFBD> Remembered Set <20>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD><D7B6><EFBFBD>Ҫͣ<D2AA><CDA3><EFBFBD>̣߳<DFB3><CCA3><EFBFBD><EFBFBD>ǿɲ<C7BF><C9B2><EFBFBD>ִ<EFBFBD>С<EFBFBD>
|
|||
|
4. ɸѡ<C9B8><D1A1><EFBFBD>գ<EFBFBD><D5A3><EFBFBD><EFBFBD>ȶԸ<C8B6><D4B8><EFBFBD> Region <20>еĻ<D0B5><C4BB>ռ<EFBFBD>ֵ<EFBFBD>ͳɱ<CDB3><C9B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><F2A3ACB8><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> GC ͣ<><CDA3><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD>ռƻ<D5BC><C6BB><EFBFBD><EFBFBD>˽<CBBD><D7B6><EFBFBD>ʵҲ<CAB5><D2B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>ִ<EFBFBD>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊֻ<CEAA><D6BB><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD> Region<6F><6E>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB>ɿ<EFBFBD><C9BF>Ƶģ<C6B5><C4A3><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD>û<EFBFBD><C3BB>߳̽<DFB3><CCBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD>Ч<EFBFBD>ʡ<EFBFBD>
|
|||
|
|
|||
|
### 3.8 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD>ıȽ<C4B1>
|
|||
|
|
|||
|
| <20>ռ<EFBFBD><D5BC><EFBFBD> | <20><><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD> or <20><><EFBFBD><EFBFBD> | <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> / <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | <20>㷨 | Ŀ<><C4BF> | <20><><EFBFBD>ó<EFBFBD><C3B3><EFBFBD> |
|
|||
|
| --- | --- | --- | --- | --- | --- |
|
|||
|
| **Serial** | <20><><EFBFBD><EFBFBD> | <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | <20><><EFBFBD><EFBFBD><EFBFBD>㷨 | <20><>Ӧ<EFBFBD>ٶ<EFBFBD><D9B6><EFBFBD><EFBFBD><EFBFBD> | <20><> CPU <20><><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> Client ģʽ |
|
|||
|
| **Serial Old** | <20><><EFBFBD><EFBFBD> | <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | <20><><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD> | <20><>Ӧ<EFBFBD>ٶ<EFBFBD><D9B6><EFBFBD><EFBFBD><EFBFBD> | <20><> CPU <20><><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> Client ģʽ<C4A3><CABD>CMS <20>ĺ<EFBFBD><C4BA><EFBFBD>Ԥ<EFBFBD><D4A4> |
|
|||
|
| **ParNew** | <20><><EFBFBD><EFBFBD> | <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | <20><><EFBFBD><EFBFBD><EFBFBD>㷨 | <20><>Ӧ<EFBFBD>ٶ<EFBFBD><D9B6><EFBFBD><EFBFBD><EFBFBD> | <20><> CPU <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> Server ģʽ<C4A3><CABD><EFBFBD><EFBFBD> CMS <20><><EFBFBD><EFBFBD> |
|
|||
|
| **Parallel Scavenge** | <20><><EFBFBD><EFBFBD> | <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | <20><><EFBFBD><EFBFBD><EFBFBD>㷨 | <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | <20>ں<EFBFBD>̨<EFBFBD><CCA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ̫<D2AA>ཻ<EFBFBD><E0BDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> |
|
|||
|
| **Parallel Old** | <20><><EFBFBD><EFBFBD> | <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | <20><><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD> | <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | <20>ں<EFBFBD>̨<EFBFBD><CCA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ̫<D2AA>ཻ<EFBFBD><E0BDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> |
|
|||
|
| **CMS** | <20><><EFBFBD><EFBFBD> | <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> | <20><><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD> | <20><>Ӧ<EFBFBD>ٶ<EFBFBD><D9B6><EFBFBD><EFBFBD><EFBFBD> | <20><><EFBFBD><EFBFBD><EFBFBD>ڻ<EFBFBD><DABB><EFBFBD><EFBFBD><EFBFBD>վ<EFBFBD><D5BE> B/S ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD> Java Ӧ<><D3A6> |
|
|||
|
| **G1** | <20><><EFBFBD><EFBFBD> | both | <20><><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD> + <20><><EFBFBD><EFBFBD><EFBFBD>㷨 | <20><>Ӧ<EFBFBD>ٶ<EFBFBD><D9B6><EFBFBD><EFBFBD><EFBFBD> | <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>ã<EFBFBD><C3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>滻 CMS |
|
|||
|
|
|||
|
## 4. <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ղ<EFBFBD><D5B2><EFBFBD>
|
|||
|
|
|||
|
### 4.1 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Eden <20><><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>£<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Eden <20><><EFBFBD><EFBFBD><EFBFBD>䣬<EFBFBD><E4A3AC> Eden <20><><EFBFBD>ռ䲻<D5BC><E4B2BB>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Minor GC<47><43>
|
|||
|
|
|||
|
### 4.2 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD>ӽ<EFBFBD><D3BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
<EFBFBD>ṩ -XX:PretenureSizeThreshold <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>ֵ<EFBFBD>Ķ<EFBFBD><C4B6><EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>䣬<EFBFBD><E4A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Eden <20><><EFBFBD><EFBFBD> Survivor <20><>֮<EFBFBD><D6AE><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD>ڴ渴<DAB4>ƣ<EFBFBD>
|
|||
|
### 4.3 <20><><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD>Ķ<EFBFBD><C4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
JVM Ϊ<><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Minor GC <20><>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD><EFBFBD>ұ<EFBFBD> Survivor <20><><EFBFBD><EFBFBD><EFBFBD>ɵģ<C9B5><C4A3>ƶ<EFBFBD><C6B6><EFBFBD> Survivor <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1<><31>ÿ<EFBFBD><C3BF><EFBFBD><EFBFBD>һ<EFBFBD><D2BB> Minor GC <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1<><31><EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC> 15 <20>꣬ͨ<EAA3AC><CDA8> -XX:MaxTenuringThreshold <20><><EFBFBD>ã<EFBFBD><C3A3><EFBFBD>
|
|||
|
|
|||
|
|
|||
|
### 4.4 <20><>̬<EFBFBD><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
|
|||
|
|
|||
|
<EFBFBD><EFBFBD> Survivor <20><><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD>ܺʹ<DCBA><CDB4><EFBFBD> Survivor <20>ռ<EFBFBD>һ<EFBFBD>룬<EFBFBD><EBA3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5>ڸ<EFBFBD><DAB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ķ<EFBFBD><C4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD>ӽ<EFBFBD><D3BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFB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D><D0A1><EFBFBD><EFBFBD><EFBFBD>ڵĻ<DAB5><C4BB><EFBFBD><EFBFBD><EFBFBD> Minor GC<47><43>С<EFBFBD>ڵĻ<DAB5><C4BB><EFBFBD><EFBFBD><EFBFBD> Full GC<47><43>
|
|||
|
|
|||
|
## 4.6 Full GC <20>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD> Minor GC<47><43><EFBFBD>䴥<EFBFBD><E4B4A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>dz<EFBFBD><C7B3><EFBFBD><F2B5A5A3><EFBFBD> Eden <20><><EFBFBD>ռ<EFBFBD><D5BC><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>ͽ<EFBFBD><CDBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB> Minor GC<47><43><EFBFBD><EFBFBD> Full GC <20><><EFBFBD><EFBFBD><EFBFBD>Ը<EFBFBD><D4B8>ӣ<EFBFBD><D3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
### 4.6.1 <20><><EFBFBD><EFBFBD> System.gc()
|
|||
|
|
|||
|
<EFBFBD>˷<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǽ<EFBFBD><EFBFBD><EFBFBD> JVM <20><><EFBFBD><EFBFBD> Full GC<47><43><EFBFBD><EFBFBD>Ȼֻ<C8BB>ǽ<EFBFBD><C7BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܶ<EFBFBD><DCB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFB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EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ķ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȣ<EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><EFBFBD> Full GC <20><><EFBFBD>ռ<EFBFBD><D5BC><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD>㣬<EFBFBD><E3A3AC><EFBFBD>׳<EFBFBD><D7B3><EFBFBD><EFBFBD>´<EFBFBD><C2B4><EFBFBD><EFBFBD><EFBFBD> Java.lang.OutOfMemoryError: Java heap space Ϊ<><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״<EFBFBD><D7B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Full GC<47><43><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱӦ<CAB1><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD><EFBFBD> Minor GC <20>α<D7B6><CEB1><EFBFBD><EFBFBD>ա<EFBFBD><D5A1>ö<EFBFBD><C3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>ʱ<EFBFBD>估<EFBFBD><E4BCB0>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ķ<EFBFBD><C4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>顣
|
|||
|
|
|||
|
### 4.6.3 <20>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD>䵣<EFBFBD><E4B5A3>ʧ<EFBFBD><CAA7>
|
|||
|
|
|||
|
ʹ<EFBFBD>ø<EFBFBD><EFBFBD><EFBFBD><EFBFBD>㷨<EFBFBD><EFBFBD> Minor GC <20><>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> HandlePromotionFailure <20><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD>ᴥ<EFBFBD><E1B4A5> Full GC<47><43>
|
|||
|
|
|||
|
### 4.6.4 JDK 1.7 <20><><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD>ô<EFBFBD><C3B4>ռ䲻<D5BC><E4B2BB>
|
|||
|
|
|||
|
<EFBFBD><EFBFBD> JDK 1.7 <20><><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0>HotSpot <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>еķ<D0B5><C4B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ô<EFBFBD>ʵ<EFBFBD>ֵģ<D6B5><C4A3><EFBFBD><EFBFBD>ô<EFBFBD><C3B4>д<EFBFBD><D0B4>ŵ<EFBFBD>ΪһЩ class <20><><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̬<EFBFBD><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD>ϵͳ<CFB5><CDB3>Ҫ<EFBFBD><D2AA><EFBFBD>ص<EFBFBD><D8B5>ࡢ<EFBFBD><E0A1A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD><CDB5>õķ<C3B5><C4B7><EFBFBD><EFBFBD>϶<EFBFBD>ʱ<EFBFBD><CAB1>Permanet Generation <20><><EFBFBD>ܻᱻռ<E1B1BB><D5BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD> CMS GC <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD><D2B2>ִ<EFBFBD><D6B4> Full GC<47><43><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Full GC <20><>Ȼ<EFBFBD><C8BB><EFBFBD>ղ<EFBFBD><D5B2>ˣ<EFBFBD><CBA3><EFBFBD>ô JVM <20><><EFBFBD>׳<EFBFBD><D7B3><EFBFBD><EFBFBD>´<EFBFBD><C2B4><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>java.lang.OutOfMemoryError: PermGen space Ϊ<><CEAA><EFBFBD><EFBFBD> PermGen ռ<><D5BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Full GC <20><><EFBFBD>ɲ<F3A3ACBF><C9B2>õķ<C3B5><C4B7><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD> PermGen <20>ռ<EFBFBD><D5BC><EFBFBD>תΪʹ<CEAA><CAB9> CMS GC<47><43>
|
|||
|
|
|||
|
<EFBFBD><EFBFBD> JDK 1.8 <20><><EFBFBD><EFBFBD>Ԫ<EF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2><EFBFBD><EFBFBD><EFBFBD> Full GC<47><43>
|
|||
|
|
|||
|
# <20><><EFBFBD><EFBFBD><EFBFBD>ػ<EFBFBD><D8BB><EFBFBD>
|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڼ䶯̬<EFBFBD><EFBFBD><EFBFBD>صġ<EFBFBD>
|
|||
|
|
|||
|
## 1 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/32b8374a-e822-4720-af0b-c0f485095ea2.jpg)
|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 7 <20><><EFBFBD>Σ<D7B6>
|
|||
|
|
|||
|
- **<2A><><EFBFBD>أ<EFBFBD>Loading<6E><67>**
|
|||
|
- **<2A><>֤<EFBFBD><D6A4>Verification<6F><6E>**
|
|||
|
- **<><D7BC><EFBFBD><EFBFBD>Preparation<6F><6E>**
|
|||
|
- **<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Resolution<6F><6E>**
|
|||
|
- **<2A><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>Initialization<6F><6E>**
|
|||
|
- ʹ<>ã<EFBFBD>Using<6E><67>
|
|||
|
- ж<>أ<EFBFBD>Unloading<6E><67>
|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD>н<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ijЩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¿<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڳ<EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>֮<EFBFBD><EFBFBD><EFBFBD>ٿ<EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>֧<EFBFBD><EFBFBD> Java <20>Ķ<EFBFBD>̬<EFBFBD><EFBFBD>
|
|||
|
|
|||
|
## 2. <20><><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>ʱ<EFBFBD><CAB1>
|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>淶<EFBFBD>в<EFBFBD>û<EFBFBD><EFBFBD>ǿ<EFBFBD><EFBFBD>Լ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD>м<EFBFBD><EFBFBD>أ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǹ淶<EFBFBD>ϸ<EFBFBD><EFBFBD>涨<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>г<EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>( <20><><EFBFBD>ء<EFBFBD><D8A1><EFBFBD>֤<EFBFBD><D6A4><EFBFBD><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŷ<EFBFBD><C5B7><EFBFBD> )
|
|||
|
|
|||
|
1. <20><><EFBFBD><EFBFBD> new<65><77>getstatic<69><63>putstatic<69><63>invokestatic <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>ָ<EFBFBD><D6B8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FBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
2. ʹ<><CAB9> java.lang.reflect <20><><EFBFBD>ķ<EFBFBD><C4B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>з<EFBFBD><D0B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>н<EFBFBD><D0BD>г<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ȴ<EFBFBD><C8B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
3. <20><><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>丸<EFBFBD>û<E0BBB9>н<EFBFBD><D0BD>й<EFBFBD><D0B9><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ȴ<EFBFBD><C8B4><EFBFBD><EFBFBD>丸<EFBFBD><E4B8B8><EFBFBD>ij<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
4. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>û<EFBFBD><C3BB><EFBFBD>Ҫָ<D2AA><D6B8>һ<EFBFBD><D2BB>Ҫִ<D2AA>е<EFBFBD><D0B5><EFBFBD><EFBFBD>ࣨ<EFBFBD><E0A3A8><EFBFBD><EFBFBD> main() <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ǹ<EFBFBD><C7B8>ࣩ<EFBFBD><E0A3A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȳ<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ࣻ
|
|||
|
|
|||
|
5. <20><>ʹ<EFBFBD><CAB9> jdk1.7 <20>Ķ<EFBFBD>̬<EFBFBD><CCAC><EFBFBD><EFBFBD>֧<EFBFBD><D6A7>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB> java.lang.invoke.MethodHandle ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ REF_getStatic, REF_putStatic, REF_invokeStatic <20>ķ<EFBFBD><C4B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>û<EFBFBD>н<EFBFBD><D0BD>й<EFBFBD><D0B9><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ȴ<EFBFBD><C8B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD> 5 <20>ֳ<EFBFBD><D6B3><EFBFBD><EFBFBD>е<EFBFBD><D0B5><EFBFBD>Ϊ<EFBFBD><CEAA>Ϊ<EFBFBD><CEAA>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>á<EFBFBD><C3A1><EFBFBD><EFBFBD><EFBFBD>֮<EFBFBD>⣬<EFBFBD><E2A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ķ<EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD>ᴥ<EFBFBD><E1B4A5><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>á<EFBFBD><C3A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õij<C3B5><C4B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӱ<EFBFBD><D3B0><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
1\. ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ø<EFBFBD><C3B8><EFBFBD><EFBFBD>ľ<EFBFBD>̬<EFBFBD>ֶΣ<D6B6><CEA3><EFBFBD><EFBFBD>ᵼ<EFBFBD><E1B5BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
```java
|
|||
|
System.out.println(SubClass.value); // value <20>ֶ<EFBFBD><D6B6><EFBFBD> SuperClass <20>ж<EFBFBD><D0B6><EFBFBD>
|
|||
|
```
|
|||
|
|
|||
|
2\. ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD>鶨<EFBFBD><E9B6A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>࣬<EFBFBD><E0A3AC><EFBFBD>ᴥ<EFBFBD><E1B4A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>ù<EFBFBD><C3B9>̻<EFBFBD><CCBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>г<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD>ɵġ<C9B5>ֱ<EFBFBD>Ӽ̳<D3BC><CCB3><EFBFBD> Object <20><><EFBFBD><EFBFBD><EFBFBD>࣬<EFBFBD><E0A3AC><EFBFBD>а<EFBFBD><D0B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ժͷ<D4BA><CDB7><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
```java
|
|||
|
SuperClass[] sca = new SuperClass[10];
|
|||
|
```
|
|||
|
|
|||
|
3\. <20><><EFBFBD><EFBFBD><EFBFBD>ڱ<EFBFBD><DAB1><EFBFBD><EFBFBD>λ<D7B6><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD><C4B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϲ<EFBFBD>û<EFBFBD><C3BB>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD>峣<EFBFBD><E5B3A3><EFBFBD><EFBFBD><EFBFBD>࣬<EFBFBD><E0A3AC><EFBFBD>˲<EFBFBD><CBB2>ᴥ<EFBFBD><E1B4A5><EFBFBD><EFBFBD><EFBFBD>峣<EFBFBD><E5B3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
```java
|
|||
|
System.out.println(ConstClass.HELLOWORLD);
|
|||
|
```
|
|||
|
|
|||
|
## 3. <20><><EFBFBD><EFBFBD><EFBFBD>ع<EFBFBD><D8B9><EFBFBD>
|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˼<EFBFBD><EFBFBD>ء<EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͳ<EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> 5 <20><><EFBFBD>Ρ<D7B6>
|
|||
|
|
|||
|
### 3.1 <20><><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD>Σ<EFBFBD>ע<EFBFBD>ⲻҪ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD>ع<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>£<EFBFBD>
|
|||
|
|
|||
|
1. ͨ<><CDA8>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȫ<EFBFBD><EFBFBD><DEB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ķ<EFBFBD><C4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
2. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD>̬<EFBFBD>洢<EFBFBD>ṹת<E1B9B9><D7AA>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>洢<EFBFBD>ṹ<EFBFBD><E1B9B9>
|
|||
|
3. <20><><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Class <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBF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D><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> java.lang.reflect.Proxy <20>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ProxyGenerator.generateProxyClass <20>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ķ<EFBFBD><C4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ɣ<EFBFBD><C9A3><EFBFBD><EFBFBD>ͳ<EFBFBD><CDB3><EFBFBD><EFBFBD><EFBFBD> JSP Ӧ<>ã<EFBFBD><C3A3><EFBFBD><EFBFBD><EFBFBD> JSP <20>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ɶ<EFBFBD>Ӧ<EFBFBD><D3A6> Class <20>ࡣ
|
|||
|
- <20><><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>ֳ<EFBFBD><D6B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ټ<EFBFBD><D9BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Щ<EFBFBD>м<EFBFBD><D0BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> SAP Netweaver<65><72><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD>ѳ<EFBFBD><D1B3><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBF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EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
3. <20>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD><D6A4>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϳ<EFBFBD><CDBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǺϷ<C7BA><CFB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><DFBC>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ķ<EFBFBD><C4B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
4. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤
|
|||
|
|
|||
|
### 3.3 <><D7BC>
|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>DZ<EFBFBD> static <20><><EFBFBD>εı<CEB5><C4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><D7BC><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ沢<DAB4><E6B2A2><EFBFBD>ó<EFBFBD>ʼֵ<CABC><D6B5>ʹ<EFBFBD>õ<EFBFBD><C3B5>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ档
|
|||
|
|
|||
|
ʵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>η<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ棬<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڶ<EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD>Ŷ<EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Java <20><><EFBFBD>С<EFBFBD>
|
|||
|
|
|||
|
<EFBFBD><EFBFBD>ʼֵһ<EFBFBD><EFBFBD>Ϊ 0 ֵ<><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> value <20><><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>Ϊ 0 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 123<32><33>
|
|||
|
|
|||
|
```java
|
|||
|
public static int value = 123;
|
|||
|
```
|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>dz<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ô<EFBFBD>ᰴ<EFBFBD>ձ<EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>г<EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ǹ<EFBFBD>ֵΪ 0<><30>
|
|||
|
|
|||
|
```java
|
|||
|
public static final int value = 123;
|
|||
|
```
|
|||
|
|
|||
|
### 3.4 <20><><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>صķ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>滻Ϊֱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õĹ<EFBFBD><EFBFBD>̡<EFBFBD>
|
|||
|
|
|||
|
### 3.5 <20><>ʼ<EFBFBD><CABC>
|
|||
|
|
|||
|
<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD>μ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <clinit>() <20><><EFBFBD><EFBFBD><EFBFBD>Ĺ<EFBFBD><C4B9>̡<EFBFBD>
|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Σ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>ϵͳҪ<EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD>ʼֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڳ<EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD>Σ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>Աͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ۼƻ<EFBFBD>ȥ<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD>
|
|||
|
|
|||
|
<clinit>() <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص㣺
|
|||
|
|
|||
|
- <20><><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĸ<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD>;<EFBFBD>̬<EFBFBD><CCAC><EFBFBD><EFBFBD><EFBFBD>飨static{} <20>飩<EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϲ<EFBFBD><CFB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><D5BC><EFBFBD>˳<EFBFBD><CBB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD>ļ<EFBFBD><C4BC>г<EFBFBD><D0B3>ֵ<EFBFBD>˳<EFBFBD><CBB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ر<EFBFBD>ע<EFBFBD><D7A2><EFBFBD><EFBFBD><EFBFBD>ǣ<EFBFBD><C7A3><EFBFBD>̬<EFBFBD><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD>ܷ<EFBFBD><DCB7>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֮ǰ<D6AE><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֮<EFBFBD><D6AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD>ܸ<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD>ܷ<EFBFBD><DCB7>ʡ<EFBFBD><CAA1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>´<EFBFBD><C2B4>룺
|
|||
|
|
|||
|
```java
|
|||
|
public class Test {
|
|||
|
static {
|
|||
|
i = 0; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>
|
|||
|
System.out.print(i); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD>á<EFBFBD>
|
|||
|
}
|
|||
|
static int i = 1;
|
|||
|
}
|
|||
|
```
|
|||
|
|
|||
|
- <20><><EFBFBD><EFBFBD><EFBFBD>Ĺ<EFBFBD><C4B9>캯<EFBFBD><ECBAAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵ʵ<CBB5><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <init>()<29><><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>ʽ<EFBFBD>ĵ<EFBFBD><C4B5>ø<EFBFBD><C3B8><EFBFBD><EFBFBD>Ĺ<EFBFBD><C4B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD>֤<EFBFBD><D6A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <clinit>() <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֮ǰ<D6AE><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <clinit>() <20><><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD>ִ<EFBFBD>н<EFBFBD><D0BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD>һ<EFBFBD><D2BB>ִ<EFBFBD><D6B4> <clinit>() <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>϶<EFBFBD>Ϊ java.lang.Object<63><74>
|
|||
|
|
|||
|
- <20><><EFBFBD>ڸ<EFBFBD><DAB8><EFBFBD><EFBFBD><EFBFBD> <clinit>() <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD>У<EFBFBD>Ҳ<EFBFBD><D2B2><EFBFBD><EFBFBD>ζ<EFBFBD>Ÿ<EFBFBD><C5B8><EFBFBD><EFBFBD>ж<EFBFBD><D0B6><EFBFBD><EFBFBD>ľ<EFBFBD>̬<EFBFBD><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>´<EFBFBD><C2B4>룺
|
|||
|
|
|||
|
```java
|
|||
|
static class Parent {
|
|||
|
public static int A = 1;
|
|||
|
static {
|
|||
|
A = 2;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
static class Sub extends Parent {
|
|||
|
public static int B = A;
|
|||
|
}
|
|||
|
|
|||
|
public static void main(String[] args) {
|
|||
|
System.out.println(Sub.B); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ǹ<EFBFBD><C7B8><EFBFBD><EFBFBD>еľ<D0B5>̬<EFBFBD><CCAC><EFBFBD><EFBFBD>ֵ A<><41>Ҳ<EFBFBD><D2B2><EFBFBD><EFBFBD> 2
|
|||
|
}
|
|||
|
```
|
|||
|
|
|||
|
- <clinit>() <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӿڲ<D3BF><DAB2>DZ<EFBFBD><C7B1><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̬<EFBFBD><CCAC><EFBFBD><EFBFBD><EFBFBD>飬Ҳû<D2B2>ж<EFBFBD><D0B6><EFBFBD><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Ҫ<EFBFBD>ɼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>౾<EFBFBD><EFBFBD>һͬȷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Java <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD>Ψһ<CEA8>ԣ<EFBFBD>ÿһ<C3BF><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD><D3B5>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƿռ䡣ͨ<E4A1A3><EFBFBD><D7B6>ԣ<EFBFBD><D4A3>Ƚ<EFBFBD><C8BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD>ġ<EFBFBD><C4A1><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Class <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> equals() <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>isAssignableFrom() <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>isInstance() <20><><EFBFBD><EFBFBD><EFBFBD>ķ<EFBFBD><C4B7>ؽ<E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FBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͱض<CDB1><D8B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD>
|
|||
|
|
|||
|
### 4.2 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
<EFBFBD><EFBFBD> Java <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĽǶ<C4BD><C7B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD><D6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֲ<EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Bootstrap ClassLoader<65><72><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> C++ ʵ<>֣<EFBFBD><D6A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>֣<EFBFBD><D6A3><EFBFBD>һ<EFBFBD>־<EFBFBD><D6BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Щ<EFBFBD><D0A9><EFBFBD><EFBFBD> Java ʵ<>֣<EFBFBD><D6A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ⲿ<EFBFBD><E2B2BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD>̳<EFBFBD><CCB3>Գ<EFBFBD><D4B3><EFBFBD><EFBFBD><EFBFBD> java.lang.ClassLoader<65><72>
|
|||
|
|
|||
|
<EFBFBD><EFBFBD> Java <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD>ĽǶȿ<C7B6><C8BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ի<EFBFBD><D4BB>ֵø<D6B5>ϸ<EFBFBD><CFB8>һЩ<D2BB><D0A9>
|
|||
|
|
|||
|
- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Bootstrap ClassLoader<65><72> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><F0BDABB4><EFBFBD><EFBFBD><EFBFBD> <JAVA_HOME>\lib Ŀ¼<C4BF>еģ<D0B5><C4A3><EFBFBD><EFBFBD>߱<EFBFBD> -Xbootclasspath <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>·<EFBFBD><C2B7><EFBFBD>еģ<D0B5><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFB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FBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD><D6B1>ʹ<EFBFBD><CAB9> null <20><><EFBFBD>漴<EFBFBD>ɡ<EFBFBD>
|
|||
|
|
|||
|
- <20><>չ<EFBFBD><D5B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Extension ClassLoader<65><72> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ExtClassLoader<65><72>sun.misc.Launcher$ExtClassLoader<65><72>ʵ<EFBFBD>ֵġ<D6B5><C4A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <Java_Home>/lib/ext <20><><EFBFBD>߱<EFBFBD> java.ext.dir ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>·<EFBFBD><C2B7><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><D8B5>ڴ<EFBFBD><DAB4>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߿<EFBFBD><DFBF><EFBFBD>ֱ<EFBFBD><D6B1>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD>չ<EFBFBD><D5B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
- Ӧ<>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Application ClassLoader<65><72> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> AppClassLoader<65><72>sun.misc.Launcher$AppClassLoader<65><72>ʵ<EFBFBD>ֵġ<D6B5><C4A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ClassLoader <20>е<EFBFBD> getSystemClassLoader() <20><><EFBFBD><EFBFBD><EFBFBD>ķ<EFBFBD><C4B7><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>Ϊϵͳ<CFB5><CDB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD>ClassPath<74><68><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⣬<EFBFBD><E2A3AC><EFBFBD><EFBFBD><EFBFBD>߿<EFBFBD><DFBF><EFBFBD>ֱ<EFBFBD><D6B1>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><D4BC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
|
|
|||
|
![](https://github.com/CyC2018/InterviewNotes/blob/master/pics/2cdc3ce2-fa82-4c22-baaa-000c07d10473.jpg)
|
|||
|
|
|||
|
**<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>**
|
|||
|
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD>ȥ<EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><EFBFBD>أ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ί<EFBFBD>ɸ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ÿһ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>εļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>εݹ飬<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>еļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ն<EFBFBD>Ӧ<EFBFBD>ô<EFBFBD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BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>߱<EFBFBD><DFB1><EFBFBD>һ<EFBFBD>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD><C8BC>IJ<EFBFBD><C4B2>ι<EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> java.lang.Object<63><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> rt.jar <20>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĸ<EFBFBD><C4B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>࣬<EFBFBD><E0A3AC><EFBFBD>ն<EFBFBD><D5B6><EFBFBD>ί<EFBFBD>ɸ<EFBFBD><C9B8><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD><D0BC>أ<EFBFBD><D8A3><EFBFBD><EFBFBD><EFBFBD> Object <20><><EFBFBD>ڳ<EFBFBD><DAB3><EFBFBD><EFBFBD>ĸ<EFBFBD><C4B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><D0B6><EFBFBD>ͬһ<CDAC><D2BB><EFBFBD>ࡣ<EFBFBD>෴<EFBFBD><E0B7B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB>˫<EFBFBD><CBAB>ί<EFBFBD><CEAF>ģ<EFBFBD>ͣ<EFBFBD><CDA3>ɸ<EFBFBD><C9B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD><D0BC>صĻ<D8B5><C4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD>д<EFBFBD><D0B4>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>java.lang.Object <20><><EFBFBD>࣬<EFBFBD><E0A3AC><EFBFBD><EFBFBD><EFBFBD>ڳ<EFBFBD><DAB3><EFBFBD><EFBFBD><EFBFBD> ClassPath <20>У<EFBFBD><D0A3><EFBFBD>ϵͳ<CFB5>н<EFBFBD><D0BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC> Object <20>࣬<EFBFBD><E0A3AC><EFBFBD><EFBFBD><F2BDABB1><EFBFBD>һƬ<D2BB><C6AC><EFBFBD>ҡ<EFBFBD><D2A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD><DFB3>Ա<EFBFBD>дһ<D0B4><D2BB><EFBFBD><EFBFBD> rt.jar <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Java <20>࣬<EFBFBD><E0A3AC><EFBFBD>ᷢ<EFBFBD>ֿ<EFBFBD><D6BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룬<EFBFBD><EBA3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD>
|
|||
|
|
|||
|
**ʵ<><CAB5>**
|
|||
|
|
|||
|
```java
|
|||
|
protected synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException{
|
|||
|
//check the class has been loaded or not
|
|||
|
Class c = findLoadedClass(name);
|
|||
|
if(c == null) {
|
|||
|
try{
|
|||
|
if(parent != null) {
|
|||
|
c = parent.loadClass(name, false);
|
|||
|
} else{
|
|||
|
c = findBootstrapClassOrNull(name);
|
|||
|
}
|
|||
|
} catch(ClassNotFoundException e) {
|
|||
|
//if throws the exception , the father can not complete the load
|
|||
|
}
|
|||
|
if(c == null) {
|
|||
|
c = findClass(name);
|
|||
|
}
|
|||
|
}
|
|||
|
if(resolve) {
|
|||
|
resolveClass(c);
|
|||
|
}
|
|||
|
return c;
|
|||
|
}
|
|||
|
```
|
|||
|
|
|||
|
# JVM <20><><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
## GC <20>Ż<EFBFBD><C5BB><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
| <20><><EFBFBD><EFBFBD> | <20><><EFBFBD><EFBFBD> |
|
|||
|
| --- | --- |
|
|||
|
| -Xms | <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD>С |
|
|||
|
| -Xmx | <20><><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD>ֵ |
|
|||
|
| -Xmn | <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С |
|
|||
|
| -XX:PermSize | <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>ô<EFBFBD><C3B4><EFBFBD>С |
|
|||
|
| -XX:MaxPermSize | <20><><EFBFBD>ô<EFBFBD><C3B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> |
|
|||
|
|
|||
|
## GC <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
| <20><><EFBFBD><EFBFBD> | <20><><EFBFBD><EFBFBD> |
|
|||
|
| --- | --- |
|
|||
|
| -XX:+UseSerialGC | <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> |
|
|||
|
| -XX:+UseParallelGC | <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> |
|
|||
|
| -XX:+UseConcMarkSweepGC | <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> |
|
|||
|
| -XX:ParallelCMSThreads= | <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = Ϊʹ<CEAA>õ<EFBFBD><C3B5>߳<EFBFBD><DFB3><EFBFBD><EFBFBD><EFBFBD> |
|
|||
|
| -XX:+UseG1GC | G1 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> |
|
|||
|
|
|||
|
```java
|
|||
|
java -Xmx12m -Xms3m -Xmn1m -XX:PermSize=20m -XX:MaxPermSize=20m -XX:+UseSerialGC -jar java-application.jar
|
|||
|
```
|