Garbage Collection Algorithms

2h 13m 20s
English
Paid

Course description

Memory 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.

Read more about the course

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 materials

As 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 Jones

  • The Compiler Design Handbook: Optimizations and Machine Code generation by Y.N. Srikant, Priti Shankar

Requirements:
  • Basic data structures and algorithms (trees, graphs, linked lists, etc)
  • Basic knowledge about computer memory (bytes, addresses, pointers)
Who this course is for:
  • Compiler engineers
  • All curious engineers, willing to implement a complex project to learn different memory management algorithms (generic knowledge is transferable to other systems)

What you'll learn:

  • Algorithms and data structures behind Automatic Memory Management in computer programs.
  • Memory management history: Static, Stack, Heap allocations
  • Virtual memory and Memory Layout
  • Tracing vs. Direct collectors
  • Semantic vs. Syntactic garbage
  • Mark-Sweep garbage collector
  • Mark-Compact collector
  • Reference counting collector
  • Copying collector
  • Generational collector
  • Parallel, Incremental, Concurrent collectors
  • Tri-color abstraction and marking
  • GC Barriers

Watch Online

This is a demo lesson (10:00 remaining)

You can watch up to 10 minutes for free. Subscribe to unlock all 17 lessons in this course and access 10,000+ hours of premium content across all courses.

View Pricing

Watch Online Garbage Collection Algorithms

0:00
/
#1: Allocation types

All Course Lessons (17)

#Lesson TitleDurationAccess
1
Allocation types Demo
05:07
2
Manual memory management
03:56
3
Object header
03:20
4
Virtual memory and Memory layout
08:58
5
Mutator, Allocator, Collector
04:36
6
Allocators: Free-list vs. Sequential
08:57
7
Semantic vs. Syntactic garbage
04:43
8
Tracing vs. Direct collectors
06:10
9
Mark-Sweep collector
07:43
10
Mark-Compact collector
10:17
11
Copying collector
11:02
12
Reference counting collector
09:47
13
Generational collector
08:38
14
Mark-Region GC: Immix collector
12:59
15
Parallel, Incremental, Concurrent GC
07:22
16
Tri-color abstraction
07:32
17
GC barriers
12:13

Unlock unlimited learning

Get instant access to all 16 lessons in this course, plus thousands of other premium courses. One subscription, unlimited knowledge.

Learn more about subscription

Comments

0 comments

Want to join the conversation?

Sign in to comment

Similar courses

Advanced Prompt Engineering

Advanced Prompt Engineering

Sources: DAIR.AI
This course is dedicated to advanced methods in Prompt Engineering for large language models (LLMs) and their effective application in various scenarios.
1 hour 23 minutes 57 seconds
The Effective Engineer, Pro Package

The Effective Engineer, Pro Package

Sources: Edmond Lau
Designed for those looking for an extra boost in their professional growth. You'll get for your own personal use: the book in PDF, Kindle, and ePub formats; the step-by-step com...
Practical Object-Oriented Design - Course I

Practical Object-Oriented Design - Course I

Sources: Sandi Metz
Practical Object-Oriented Design I (POOD-I) is a course suitable for both beginners and experienced developers working with object-oriented...
11 hours 49 minutes 53 seconds
Start with TALL: Use Tailwind, Alpine, Laravel & Livewire

Start with TALL: Use Tailwind, Alpine, Laravel & Livewire

Sources: udemy
Get ahead of the competition and start with the TALL stack, made up of Tailwind CSS, Alpine.js, Livewire, and Laravel that will completely dominate the world of
4 hours 17 minutes 21 seconds
Feature Flags: Transform Your Product Development Workflow

Feature Flags: Transform Your Product Development Workflow

Sources: Ben Nadel
My development team constantly deployed critical errors to production. We spent as much time fixing failures and writing reports on...