Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
disable the freelist after clearing it in interpreter_clear
  • Loading branch information
iritkatriel committed Feb 8, 2023
commit 044743e0ee10ec3404266a7215bf0af8f751bd77
6 changes: 2 additions & 4 deletions Python/pystate.c
Original file line number Diff line number Diff line change
Expand Up @@ -717,13 +717,11 @@ PyInterpreterState_New(void)

init_interpreter(interp, runtime, id, old_head, pending_lock);

#if WITH_FREELISTS
for (int i=0; i < INTERP_NUM_FREELISTS; i++) {
_PyFreeList_Init(&interp->freelists[i],
FREELIST_INDEX_TO_ALLOCATED_SIZE(i),
SMALL_OBJECT_FREELIST_SIZE);
}
#endif

HEAD_UNLOCK(runtime);
return interp;
Expand Down Expand Up @@ -767,11 +765,11 @@ interpreter_clear(PyInterpreterState *interp, PyThreadState *tstate)
}
HEAD_UNLOCK(runtime);

#if WITH_FREELISTS
for (int i=0; i < INTERP_NUM_FREELISTS; i++) {
_PyFreeList_Clear(&interp->freelists[i]);
interp->freelists[i].space = 0;
interp->freelists[i].capacity = 0;
}
#endif

/* It is possible that any of the objects below have a finalizer
that runs Python code or otherwise relies on a thread state
Expand Down