Skip to content

Commit

Permalink
Trashcan consumes more C stack (experimental, targeting WASI Debug bu…
Browse files Browse the repository at this point in the history
…ild)
  • Loading branch information
gvanrossum committed Apr 30, 2024
1 parent f45f7ca commit 391bd46
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Include/cpython/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -468,8 +468,8 @@ PyAPI_FUNC(void) _PyTrash_thread_destroy_chain(PyThreadState *tstate);

/* Python 3.10 private API, invoked by the Py_TRASHCAN_BEGIN(). */

/* To avoid raising recursion errors during dealloc trigger trashcan before we reach
* recursion limit. To avoid trashing, we don't attempt to empty the trashcan until
/* To avoid raising recursion errors during dealloc, trigger trashcan before we reach
* recursion limit. To avoid thrashing, we don't attempt to empty the trashcan until
* we have headroom above the trigger limit */
#define Py_TRASHCAN_HEADROOM 50

Expand All @@ -480,10 +480,10 @@ do { \
_PyTrash_thread_deposit_object(tstate, (PyObject *)op); \
break; \
} \
tstate->c_recursion_remaining--;
tstate->c_recursion_remaining -= 2;
/* The body of the deallocator is here. */
#define Py_TRASHCAN_END \
tstate->c_recursion_remaining++; \
tstate->c_recursion_remaining += 2; \
if (tstate->delete_later && tstate->c_recursion_remaining > (Py_TRASHCAN_HEADROOM*2)) { \
_PyTrash_thread_destroy_chain(tstate); \
} \
Expand Down

0 comments on commit 391bd46

Please sign in to comment.