This is an old copy of the Python FAQ. The information here may be outdated.

Why isn't all memory freed when Python exits?

Objects referenced from the global namespaces of Python modules are not always deallocated when Python exits. This may happen if there are circular references. There are also certain bits of memory that are allocated by the C library that are impossible to free (e.g. a tool like Purify will complain about these). Python is, however, aggressive about cleaning up memory on exit and does try to destroy every single object.

If you want to force Python to delete certain things on deallocation, you can use the atexit module to register one or more exit functions to handle those deletions.

CATEGORY: general

 

A Django site. rendered by a django application. hosted by webfaction.