Mercurial > cpython-lru_cache-weakref
diff Python/pythonrun.c @ 87676:cc8953ea3c7e
Closes #19831: Stop tracemalloc later at Python shutdown to be able to use
tracemalloc in objects destructor
Replace atexit handler with an harcoded C function _PyTraceMalloc_Fini().
| author | Victor Stinner <victor.stinner@gmail.com> |
|---|---|
| date | Sun, 01 Dec 2013 10:03:26 +0100 |
| parents | 6e2089dbc5ad |
| children |
line wrap: on
line diff
--- a/Python/pythonrun.c Sun Dec 01 00:13:35 2013 -0800 +++ b/Python/pythonrun.c Sun Dec 01 10:03:26 2013 +0100 @@ -106,6 +106,7 @@ extern void _PyFaulthandler_Fini(void); extern void _PyHash_Fini(void); extern int _PyTraceMalloc_Init(void); +extern int _PyTraceMalloc_Fini(void); #ifdef WITH_THREAD extern void _PyGILState_Init(PyInterpreterState *, PyThreadState *); @@ -642,6 +643,10 @@ PyGC_Collect(); #endif + /* Disable tracemalloc after all Python objects have been destroyed, + so it is possible to use tracemalloc in objects destructor. */ + _PyTraceMalloc_Fini(); + /* Destroy the database used by _PyImport_{Fixup,Find}Extension */ _PyImport_Fini();
