summaryrefslogtreecommitdiffstats
path: root/Python/tracemalloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/tracemalloc.c')
-rw-r--r--Python/tracemalloc.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/Python/tracemalloc.c b/Python/tracemalloc.c
index 19b64c6..e3ec720 100644
--- a/Python/tracemalloc.c
+++ b/Python/tracemalloc.c
@@ -906,6 +906,10 @@ _PyTraceMalloc_Start(int max_nframe)
return -1;
}
+ if (PyRefTracer_SetTracer(_PyTraceMalloc_TraceRef, NULL) < 0) {
+ return -1;
+ }
+
if (tracemalloc_config.tracing) {
/* hook already installed: do nothing */
return 0;
@@ -1352,8 +1356,12 @@ _PyTraceMalloc_Fini(void)
Do nothing if tracemalloc is not tracing memory allocations
or if the object memory block is not already traced. */
int
-_PyTraceMalloc_NewReference(PyObject *op)
+_PyTraceMalloc_TraceRef(PyObject *op, PyRefTracerEvent event, void* Py_UNUSED(ignore))
{
+ if (event != PyRefTracer_CREATE) {
+ return 0;
+ }
+
assert(PyGILState_Check());
if (!tracemalloc_config.tracing) {