Skip to content

Commit

Permalink
Experiment: reftracer
Browse files Browse the repository at this point in the history
  • Loading branch information
colesbury committed Dec 10, 2024
1 parent 5c89adf commit 1ab24ec
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions Objects/object.c
Original file line number Diff line number Diff line change
Expand Up @@ -2953,6 +2953,14 @@ _PyObject_AssertFailed(PyObject *obj, const char *expr, const char *msg,
Py_FatalError("_PyObject_AssertFailed");
}

Py_NO_INLINE
static void
reftracer_destroy(PyObject *op)
{
_PyReftracerTrack(op, PyRefTracer_DESTROY);
Py_DECREF(op);
}


void
_Py_Dealloc(PyObject *op)
Expand All @@ -2972,8 +2980,12 @@ _Py_Dealloc(PyObject *op)
#ifdef Py_TRACE_REFS
_Py_ForgetReference(op);
#endif
_PyReftracerTrack(op, PyRefTracer_DESTROY);
(*dealloc)(op);
if (_PyRuntime.ref_tracer.tracer_func) {
reftracer_destroy(op);
}
else {
(*dealloc)(op);
}

#ifdef Py_DEBUG
// gh-89373: The tp_dealloc function must leave the current exception
Expand Down

0 comments on commit 1ab24ec

Please sign in to comment.