mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +00:00
gh-128679: Redesign tracemalloc locking (#128888)
* Use TABLES_LOCK() to protect 'tracemalloc_config.tracing'. * Hold TABLES_LOCK() longer while accessing tables. * tracemalloc_realloc() and tracemalloc_free() no longer remove the trace on reentrant call. * _PyTraceMalloc_Stop() unregisters _PyTraceMalloc_TraceRef(). * _PyTraceMalloc_GetTraces() sets the reentrant flag. * tracemalloc_clear_traces_unlocked() sets the reentrant flag.
This commit is contained in:
parent
080f444a58
commit
36c5e3bcc2
5 changed files with 302 additions and 364 deletions
|
@ -707,7 +707,12 @@ pycore_create_interpreter(_PyRuntimeState *runtime,
|
|||
// the settings are loaded (so that feature_flags are set) but before
|
||||
// any calls are made to obmalloc functions.
|
||||
if (_PyMem_init_obmalloc(interp) < 0) {
|
||||
return _PyStatus_NO_MEMORY();
|
||||
return _PyStatus_NO_MEMORY();
|
||||
}
|
||||
|
||||
status = _PyTraceMalloc_Init();
|
||||
if (_PyStatus_EXCEPTION(status)) {
|
||||
return status;
|
||||
}
|
||||
|
||||
PyThreadState *tstate = _PyThreadState_New(interp,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue