From be59539858efb66d2b746a402d4b2c4a90f1e567 Mon Sep 17 00:00:00 2001 From: Timothy Palpant Date: Sat, 19 Oct 2019 12:51:46 -0400 Subject: [PATCH] Move comment to better site for clarity --- src/heap.cc | 6 +----- src/heap.h | 4 ++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/heap.cc b/src/heap.cc index b62c23d..d1cef1b 100644 --- a/src/heap.cc +++ b/src/heap.cc @@ -1,12 +1,8 @@ #include "heap.h" // Records the given pointer and size in the current set of live ptrs, -// associated with the current stack trace. +// associated with the current stack trace. The GIL must be held. void HeapProfiler::RecordMalloc(void *ptr, size_t size) { - // The RAW allocator may be called without the GIL held. - // We may increase references to the filename fields in the - // code object when we save the trace, so we need to first ensure that - // the GIL is held. CallTrace trace; GetCurrentCallTrace(&trace, max_frames_); auto trace_handle = traces_.Intern(trace); diff --git a/src/heap.h b/src/heap.h index c2a9be2..fa1f358 100644 --- a/src/heap.h +++ b/src/heap.h @@ -81,6 +81,10 @@ inline void HeapProfiler::HandleMalloc(void *ptr, std::size_t size, return; } + // The RAW allocator may be called without the GIL held. + // We may increase references to the filename fields in the + // code object when we save the trace, so we need to first ensure that + // the GIL is held. PyGILState_STATE gil_state; if (is_raw) { gil_state = PyGILState_Ensure();