|
所在平台: Udemy |
课程主页: https://www.udemy.com/course/essentials-of-garbage-collectors/
课程评论:没有评论
**课程名称:垃圾回收算法** **课程概览:** 本课程深入探讨自动内存管理的核心——垃圾回收器。手动内存管理容易导致内存泄漏和悬空指针等问题,例如在链表中删除父节点却忘记删除子节点,或者在正确删除对象链后,由于存在第二个资源拥有者尝试解引用一个空指针而导致程序崩溃。 为了避免这些问题,现代高级编程语言普遍采用自动内存管理。程序员负责对象的分配,而垃圾回收器(Garbage Collector, GC)则能自动、正确地回收不再使用的内存,为将来的使用腾出空间。 在本课程“垃圾回收器入门”中,您将学习当前实践中使用的各种自动内存管理技术和算法。 **课程目标受众:** * **编译器工程师:** 在实现编程语言时,垃圾回收器的实现几乎是必不可少的。即使是像Rust这样最初定位为“内存安全”的语言,也最终实现了自动引用计数(ARC)及其他回收器。几乎所有现代高级编程语言都需要一个或多个垃圾回收器模块(例如Java)。 * **非编译器工程师:** 即使您不日常开发编程语言,本课程仍能为您带来价值。实现垃圾回收器或内存管理器是一项高级工程任务。通过构建复杂的项目(如垃圾回收器、编译器、解释器等),您可以学习各种数据结构和算法。完成课程后,您将以更强的工程能力和对复杂系统的通用知识回到日常编程工作中。 **课程开发环境:** * C/C++并非强制要求。虽然C/C++在原始内存操作方面非常适合,但本课程主要关注垃圾回收器和内存分配器的理论和通用设计算法。您可以使用JavaScript(通过`ArrayBuffer`模拟虚拟堆)、Python、Rust等任何语言进行实现。 * 课程中的算法通常以伪代码形式描述,方便您移植到任何语言。 **课程特色:** * **精炼且直观:** 每节课内容都自成一体,重点突出,不包含无关信息。 * **动画演示与实时编辑笔记结合:** 这种方式有助于理解抽象概念,并能展示对象结构之间的连接方式和时机。相比之下,静态幻灯片难以有效传达复杂内容。 **推荐阅读材料:** * 《垃圾收集手册:自动内存管理的艺术》(The Garbage Collection Handbook: The Art of Automatic Memory Management) by Antony Hosking, Eliot Moss, and Richard Jones * 《编译器设计手册:优化与机器码生成》(The Compiler Design Handbook: Optimizations and Machine Code generation) by Y.N. Srikant, Priti Shankar **课程大纲:**(无具体大纲提供)
Essentials of Garbage CollectorsMemory leaks and dangling pointers are the main issues of the manual memory management. You delete a parent node in a linked list, forgetting to delete all its children first - and your memory is leaking. You delete an object chain in correct order - but suddenly your program crashes since you forgot about second owner of this resource, which now tries to dereference a null-pointer.To avoid these issues, most of the modern high-level programming languages implement automatic memory management. You allocate objects manually, however don't bother with their deallocation: a special program, garbage collector, knows how to automatically deallocate them correctly, and reclaim for future reuse.In the Essentials of Garbage Collectors class we study all different techniques and algorithms related to the automatic memory management, which are used today on practice.Who this class is for?First of all, for compiler engineers.In implementing your programming language, there is a very high chance you'll need to implement a garbage collector. Even languages which initially were positioned as "memory-safe", such as Rust, eventual implemented automatic reference counting (ARC) and other collectors.To reiterate: in most of the modern high-level programming languages, a garbage collector module (or multiple GC modules, like in Java) is pretty much a requirement today.What if I don't implement programming languages every day?If you are not a compiler engineer, then the class can still be interesting for you. Implementing a garbage collector or a memory manager in general, is a pretty advanced engineering task. It's a simple trick: you take some complex project (such as a garbage collector, compiler, interpreter, etc), and while building it, you learn all different data structures and algorithms. And then come back to "every-day programming", improved as a better engineer, with the transferable generic knowledge of complex systems.Do I need C or C++ for this project?Not really! Of course, C and C++ are probably the best languages for raw memory manipulations and fit well here, however in the course we study generic design algorithms and focus mainly on theoretical aspects of garbage collectors and memory allocators. This means you can implement them in any language you want. For example, you can allocate an `ArrayBuffer` in JavaScript for a virtual heap, or similarly `bytearray` in Python, Rust, etc.Most of the algorithms in the course are described in generic pseudo-code, so you can port them to any language.What's specific in this class?The main things of these lectures are:Concise and straight to the point. Each lecture is self-sufficient, concise, and describes information directly related to the topic, not distracting on unrelated materials or talks.Animated presentation combined with live-editing notes. This makes understanding of the topics easier, and shows how (and when at time) the object structures are connected. Static slides simply don't work for a complex content.Reading materialsAs further reading and additional literature for this course the following books are recommended:The Garbage Collection Handbook: The Art of Automatic Memory Management by Antony Hosking, Eliot Moss, and Richard JonesThe Compiler Design Handbook: Optimizations and Machine Code generation by Y.N. Srikant, Priti Shankar