The reference counting is used for garbage collector.
It is the process by which Python periodically frees blocks of memory that no longer are in use. Python's garbage collector runs during program execution and is triggered when an object's reference count reaches zero.
if the reference to an object is 0, object has a deallocation function which "frees" object from memory, and other object can use it.
Generational Garbage Collection with dealing cyclic reference counting a.append(a)