Skip to content

Commit

Permalink
Move comment to better site for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
timpalpant committed Oct 19, 2019
1 parent dc6431d commit be59539
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 1 addition & 5 deletions src/heap.cc
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
4 changes: 4 additions & 0 deletions src/heap.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit be59539

Please sign in to comment.