mirror of
https://github.com/python/cpython.git
synced 2025-08-30 05:35:08 +00:00
[3.13] gh-129185: Fix PyTraceMalloc_Untrack() at Python exit (#129191) (#129217) gh-129185: Fix PyTraceMalloc_Untrack() at Python exit (#129191) Support calling PyTraceMalloc_Track() and PyTraceMalloc_Untrack() during late Python finalization. * Call _PyTraceMalloc_Fini() later in Python finalization. * Test also PyTraceMalloc_Untrack() without the GIL * PyTraceMalloc_Untrack() now gets the GIL. * Test also PyTraceMalloc_Untrack() in test_tracemalloc_track_race(). (cherry picked from commit46c7e13c05
) (cherry picked from commite3b3e01d6a
)
This commit is contained in:
parent
880ad1813e
commit
bb7c54d5ba
5 changed files with 78 additions and 14 deletions
|
@ -1933,7 +1933,7 @@ Py_FinalizeEx(void)
|
|||
|
||||
/* Disable tracemalloc after all Python objects have been destroyed,
|
||||
so it is possible to use tracemalloc in objects destructor. */
|
||||
_PyTraceMalloc_Fini();
|
||||
_PyTraceMalloc_Stop();
|
||||
|
||||
/* Finalize any remaining import state */
|
||||
// XXX Move these up to where finalize_modules() is currently.
|
||||
|
@ -1986,6 +1986,8 @@ Py_FinalizeEx(void)
|
|||
|
||||
finalize_interp_clear(tstate);
|
||||
|
||||
_PyTraceMalloc_Fini();
|
||||
|
||||
#ifdef WITH_PYMALLOC
|
||||
if (malloc_stats) {
|
||||
_PyObject_DebugMallocStats(stderr);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue