Whenever Python exits, why isn’t all the memory de-allocated?
Python modules are not always de-allocated when Python exits.
Explanation:
-
The modules with circular references to other objects, or to objects referenced from global namespaces, aren’t always freed on exiting Python.
-
Plus, it is impossible to de-allocate portions of memory reserved by the C library.
-
On exit, because of having its own efficient cleanup mechanism, Python would try to de-allocate/destroy every other object.