MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / track_alloc_hook

Function track_alloc_hook

src/misc/alloc_tracker.cpp:182–195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

180// noinline so the skipFrames count above reliably drops this frame.
181#if defined(_MSC_VER)
182__declspec(noinline)
183#else
184__attribute__((noinline))
185#endif
186void track_alloc_hook(void *p, size_t sz) noexcept {
187 if (!g_armed.load(std::memory_order_relaxed)) return;
188 if (!p || tl_inside) return;
189 ReentryGuard g;
190 AllocInfo info;
191 info.size = sz;
192 info.frameCount = capture_stack(info.frames, kFrames);
193 std::lock_guard<std::mutex> lock(getMutex());
194 getMap().insert(p, info);
195}
196
197void track_free_hook(void *p) noexcept {
198 if (!g_armed.load(std::memory_order_relaxed)) return;

Callers 2

track_new_implFunction · 0.70
track_new_aligned_implFunction · 0.70

Calls 3

capture_stackFunction · 0.85
loadMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected