Skip to content

Commit

Permalink
chore: add prettier config
Browse files Browse the repository at this point in the history
  • Loading branch information
yanglbme committed May 25, 2023
1 parent 27eab34 commit d04ea31
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 45 deletions.
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.idea/
.github/
node_modules/
docs/.vuepress/
10 changes: 10 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"trailingComma": "all",
"bracketSpacing": true,
"jsxBracketSameLine": false,
"arrowParens": "avoid"
}
62 changes: 31 additions & 31 deletions docs/.vuepress/config.js
Original file line number Diff line number Diff line change
@@ -1,56 +1,56 @@
module.exports = {
lang: "zh-CN",
title: "JVM 底层原理最全知识总结",
description: "Doocs开源社区",
lang: 'zh-CN',
title: 'JVM 底层原理最全知识总结',
description: 'Doocs开源社区',
head: [
[
"link",
'link',
{
rel: "icon",
href: "https://avatars.githubusercontent.com/u/43716716?s=200&v=4",
rel: 'icon',
href: 'https://avatars.githubusercontent.com/u/43716716?s=200&v=4',
},
],
],
base: "/jvm/",
base: '/jvm/',
themeConfig: {
repo: "doocs/jvm",
logo: "https://avatars.githubusercontent.com/u/43716716?s=200&v=4",
repo: 'doocs/jvm',
logo: 'https://avatars.githubusercontent.com/u/43716716?s=200&v=4',
open: true,
contributorsText: "贡献者",
docsDir: "docs",
editLinkText: "编辑",
lastUpdatedText: "最近更新时间",
contributorsText: '贡献者',
docsDir: 'docs',
editLinkText: '编辑',
lastUpdatedText: '最近更新时间',
locales: {
"/": {
tip: "说明",
warning: "注意",
danger: "警告",
'/': {
tip: '说明',
warning: '注意',
danger: '警告',
},
},
sidebar: [
{
text: "指南",
text: '指南',
children: [
"/00-quickstart.md",
"/01-jvm-memory-structure.md",
"/02-hotspot-jvm-object.md",
"/03-gc-algorithms.md",
"/04-hotspot-gc.md",
"/05-memory-allocation-gc.md",
"/06-jvm-performance-tuning.md",
"/07-class-structure.md",
"/08-load-class-time.md",
"/09-load-class-process.md",
"/10-class-loader.md",
'/00-quickstart.md',
'/01-jvm-memory-structure.md',
'/02-hotspot-jvm-object.md',
'/03-gc-algorithms.md',
'/04-hotspot-gc.md',
'/05-memory-allocation-gc.md',
'/06-jvm-performance-tuning.md',
'/07-class-structure.md',
'/08-load-class-time.md',
'/09-load-class-process.md',
'/10-class-loader.md',
],
},
],
},
plugins: [
[
"@vuepress/plugin-search",
'@vuepress/plugin-search',
{
isSearchable: (page) => page.path !== "/",
isSearchable: page => page.path !== '/',
},
],
],
Expand Down
4 changes: 0 additions & 4 deletions docs/01-jvm-memory-structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,6 @@ Java 中任何一个普通方法都具备虚函数的特征(运行期确认,

![jvm-memory](https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/gh/doocs/jvm@main/images/jvm-memory.png)



### 堆的特点

- 线程共享,整个 Java 虚拟机只有一个堆,所有的线程都访问同一个堆。而程序计数器、Java 虚拟机栈、本地方法栈都是一个线程对应一个。
Expand Down Expand Up @@ -286,6 +284,4 @@ Java 虚拟机规范中定义方法区是堆的一个逻辑部分。方法区存

> 服务器管理员在配置虚拟机参数时,会根据实际内存设置`-Xmx`等参数信息,但经常忽略直接内存,使得各个内存区域总和大于物理内存限制,从而导致动态扩展时出现`OutOfMemoryError`异常。


> ![jvm-off-heap-memory](https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/gh/doocs/jvm@main/images/jvm-off-heap-memory.png)
2 changes: 0 additions & 2 deletions docs/02-hotspot-jvm-object.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ HotSpot VM 的自动内存管理系统要求对象的大小必须是 8 字节的

至此,整个对象的创建过程就完成了。



## 对象的访问方式

所有对象的存储空间都是在堆中分配的,但是这个对象的引用却是在堆栈中分配的。也就是说在建立一个对象时两个地方都分配内存,在堆中分配的内存实际建立这个对象,而在堆栈中分配的内存只是一个指向这个堆对象的指针(引用)而已。 那么根据引用存放的地址类型的不同,对象有不同的访问方式。
Expand Down
4 changes: 0 additions & 4 deletions docs/03-gc-algorithms.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ GC Roots 并不包括堆中对象所引用的对象,这样就不会有循环

![](https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/gh/doocs/jvm@main/images/finalize-method-process.jpg)



JVM 会判断此对象是否有必要执行 finalize() 方法,如果对象没有覆盖 finalize() 方法,或者 finalize() 方法已经被虚拟机调用过,那么视为“没有必要执行”。那么对象基本上就真的被回收了。

如果对象被判定为有必要执行 finalize() 方法,那么对象会被放入一个 F-Queue 队列中,虚拟机会以较低的优先级执行这些 finalize()方法,但不会确保所有的 finalize() 方法都会执行结束。如果 finalize() 方法出现耗时操作,虚拟机就直接停止指向该方法,将对象清除。
Expand All @@ -71,8 +69,6 @@ JVM 会判断此对象是否有必要执行 finalize() 方法,如果对象没

> 任何一个对象的 finalize() 方法只会被系统自动调用一次,如果对象面临下一次回收,它的 finalize() 方法不会被再次执行,想继续在 finalize() 中自救就失效了。


## 回收方法区内存

方法区中存放生命周期较长的类信息、常量、静态变量,每次垃圾收集只有少量的垃圾被清除。方法区中主要清除两种垃圾:
Expand Down
16 changes: 16 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
},
"devDependencies": {
"@vuepress/plugin-search": "2.0.0-beta.49",
"prettier": "2.8.8",
"vuepress": "2.0.0-beta.49"
},
"repository": {
Expand Down
8 changes: 4 additions & 4 deletions vercel.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"github": {
"silent": true
}
}
"github": {
"silent": true
}
}

0 comments on commit d04ea31

Please sign in to comment.