Skip to content

Commit

Permalink
fix: typo (changkun#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
esphas authored and changkun committed May 21, 2018
1 parent 67c9f6b commit e705ef8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions book/zh-cn/05-pointers.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: 第 5 章 标准库:容器
title: 第 5 章 标准库:指针
type: book-zh-cn
order: 5
---
Expand Down Expand Up @@ -157,7 +157,7 @@ int main() {
}
```
运行结果是 A, B 都不会被销毁,这是因为 a,b 内部的 pointer 同时又引用了 `a,b`,这使得 `a,b` 的引用计数均变为了 2,而离开作用域时,`a,b` 智能指针被析构,却智能造成这块区域的引用计数减一,这样就导致了 `a,b` 对象指向的内存区域引用计数不为零,而外部已经没有办法找到这块区域了,也就造成了内存泄露,如图所示:
运行结果是 A, B 都不会被销毁,这是因为 a,b 内部的 pointer 同时又引用了 `a,b`,这使得 `a,b` 的引用计数均变为了 2,而离开作用域时,`a,b` 智能指针被析构,却只能造成这块区域的引用计数减一,这样就导致了 `a,b` 对象指向的内存区域引用计数不为零,而外部已经没有办法找到这块区域了,也就造成了内存泄露,如图所示:
![](../../assets/figures/pointers1.png)
Expand All @@ -183,4 +183,4 @@ int main() {
<a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/4.0/"><img alt="知识共享许可协议" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-nd/4.0/80x15.png" /></a>
本教程由[欧长坤](https://github.com/changkun)撰写,采用[知识共享署名-非商业性使用-禁止演绎 4.0 国际许可协议](http://creativecommons.org/licenses/by-nc-nd/4.0/)许可。项目中代码使用 MIT 协议开源,参见[许可](../LICENSE)。
本教程由[欧长坤](https://github.com/changkun)撰写,采用[知识共享署名-非商业性使用-禁止演绎 4.0 国际许可协议](http://creativecommons.org/licenses/by-nc-nd/4.0/)许可。项目中代码使用 MIT 协议开源,参见[许可](../LICENSE)。

0 comments on commit e705ef8

Please sign in to comment.