Upon exiting, Python’s built-in effective cleanup mechanism comes into play and try to deallocate or destroy every other object.
However, Python modules that are having circular references to other objects or the objects that are referenced from the global namespaces aren’t always deallocated or destroyed.
This is because it is not possible to deallocate those portions of the memory that are reserved by the C library.