mirror of
https://github.com/python/cpython.git
synced 2025-08-22 09:45:06 +00:00
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().
This commit is contained in:
parent
54532c9742
commit
be0708f066
2 changed files with 15 additions and 67 deletions
|
@ -106,6 +106,7 @@ extern int _PyFaulthandler_Init(void);
|
|||
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 @@ Py_Finalize(void)
|
|||
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();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue