How Python Memory management works Part 2|Generational Garbage collection|Python Interview Questions

preview_player
Показать описание
Generational garbage collection is a cycle detection based algorithm which is used by Python garbage collector in order to deal with 'Reference cycles', a situation which the reference counting algorithm can not resolve.

In the last video of this particular topic, we discussed about the Reference counting algorithm as a way to manage memory in Python. Now in this video, we are going to see the limitations of reference counting and learn how python uses the Generational garbage collection algorithm to tackle the reference cycle problem.

External Resources:

Video links:
Python Interview questions series:

Timestamps:
0:00 - Introduction
1:02 - Video Outline
1:15 - Refresher on reference counting
2:23 - What is Circular reference/Reference cycles
6:09 - Generational Garbage collection Intuition
8:49 - Key points to keep in Mind
10:04 - What are generations
12:10 - What is Threshold
16:14 - Cycle detection algorithm overview
27:42 - Code examples for reference cycle and gc module

Thank you for watching the video, if you like this and would want to be a part of this community, do subscribe to the channel and like this video.
Рекомендации по теме
Комментарии
Автор

Great information. One thing I would like to add here, in each of the generation GC performs 3 phases, a) marking, b) sweeping, c) collecting.

DivyaPrakash-mjvz
Автор

Thanks for the crystal clear explanation

valeeswarank