[Python-Dev] Caching objects in memory

Raymond Hettinger python at rcn.com
Thu Apr 21 19:01:03 CEST 2005


[Facundo Batista]
> Is there a document that details which objects are cached in memory
> (to not create the same object multiple times, for performance)?

The caches get cleaned-up before Python exit's, so you can find them all
listed together in the code in Python/pythonrun.c:

        /* Sundry finalizers */
        PyMethod_Fini();
        PyFrame_Fini();
        PyCFunction_Fini();
        PyTuple_Fini();
        PyList_Fini();
        PyString_Fini();
        PyInt_Fini();
        PyFloat_Fini();

#ifdef Py_USING_UNICODE
        /* Cleanup Unicode implementation */
        _PyUnicode_Fini();
#endif


Raymond Hettinger


More information about the Python-Dev mailing list