知识卡片
内存安全仍需资源管理
Go的类型、边界检查和垃圾回收减轻了手工管理内存的负担,减少悬空指针等错误类别。纠正原文的绝对说法:垃圾回收不能释放仍被引用却已无业务用途的对象,也不能替程序员关闭文件、停止泄漏的goroutine;unsafe和cgo还有额外边界。内存安全不等于没有资源泄漏。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- Why Go Rules the Cloud Native World · 查看原书依据
For the programmer, the fact that Go is a garbage collected language obviates the need to carefully track and free up memory every allocated byte, eliminating a considerable bookkeeping burden from the programmer’s shoulders. Life without malloc is liberating. What’s more, by eliminating manual memory management and manipulation — even pointer arithmetic — Go’s designers
参考来源
- 位置:《Cloud Native Go》第02章《Why Go Rules the Cloud Native World》(来源项目book-sources;源文件:extracted/Cloud Native Go (Matthew A. Titmus)/_epub-src/OEBPS/ch02.xhtml)
- 结论依据:Go的类型、边界检查和垃圾回收减轻了手工管理内存的负担,减少悬空指针等错误类别。原文相应定义、示例或限制为此结论提供依据;补充纠错与版本边界在正文就近标明。
- 原始内容:For the programmer, the fact that Go is a garbage collected language obviates the need to carefully track and free up memory every allocated byte, eliminating a considerable bookkeeping burden from the programmer’s shoulders. Life without malloc is liberating. What’s more, by eliminating manual memory management and manipulation — even pointer arithmetic — Go’s designers