Understand how memory management works, even though you don’t have to do it yourself

In languages like C or C++, the programmer is responsible for the dynamic allocation and deallocation of memory on the heap. But in Python, programmers don’t have to preallocate or deallocate memory.

Python uses the following garbage-collection algorithms for memory management:

  • Reference counting
  • A cycle-detecting algorithm (circular references)

Reference Counting

Reference counting…

Prashant Sharma

Software Engineer | Python enthusiast |

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store