| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
early in `PyTraceMalloc_Track` and `PyTraceMalloc_Untrack` if tracemalloc isn't enabled. This avoids a significant scaling issue when tracemalloc isn't enabled, in extension modules that properly use the PyTraceMalloc_Track API (like numpy).
| /* everything is ready: start tracing Python memory allocations */ | ||
| TABLES_LOCK(); | ||
| tracemalloc_config.tracing = 1; | ||
| _Py_atomic_store_int_release(&tracemalloc_config.tracing, 1); |
There was a problem hiding this comment.
I think release is stronger than necessary because there are no data dependencies. The actual functions are called with the lock held anyways so only atomicity of tracing matters.
Sorry, something went wrong.
There was a problem hiding this comment.
I think there is a hidden data dependency: we don't want tracing to be enabled, an allocation to be tracked, and then another thread deallocating that tracked data without untracking.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Use atomics for the _PyRuntime.tracemalloc.config.tracing so we can bail early in PyTraceMalloc_Track and PyTraceMalloc_Untrack if tracemalloc isn't enabled. This avoids a significant scaling issue when tracemalloc isn't enabled, in extension modules that properly use the PyTraceMalloc_Track API (like numpy).