Skip to content

Commit 8b9cb49

Browse files
committed
Address code review
1 parent 471d7da commit 8b9cb49

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

‎Python/pystate.c‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,16 @@ alloc_interpreter(void)
466466
static void
467467
free_interpreter(PyInterpreterState *interp)
468468
{
469+
#ifdef Py_GIL_DISABLED
470+
mi_subproc_t *subproc = interp->mimalloc.subproc;
471+
if (subproc != NULL) {
472+
// Delete the sub-process only when no abandoned segment points to it.
473+
if (mi_atomic_load_relaxed(&subproc->abandoned_count) == 0) {
474+
mi_subproc_delete(subproc);
475+
}
476+
interp->mimalloc.subproc = NULL;
477+
}
478+
#endif
469479
#ifdef Py_STATS
470480
if (interp->pystats_struct) {
471481
PyMem_RawFree(interp->pystats_struct);

0 commit comments

Comments
 (0)