+ 13
How memory is managed in python??
2 Answers
+ 13
https://docs.python.org/3/c-api/memory.html
+ 2
So in python garbage collection is done automatically compared to C++ where we must write code to remove unwanted memory. It works on reference counting, the number of times a variable has been referred to. For example when a new variable is created, its reference count increases by 1 and when we mutate it, its reference increases again. If we delete or change reference, its reference count decreases. Python memory collection is handled very systamatically.
Hope this helps ^_^.