| 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 |
| 186 | void 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 | |
| 197 | void track_free_hook(void *p) noexcept { |
| 198 | if (!g_armed.load(std::memory_order_relaxed)) return; |
no test coverage detected