I wrote a memory tracking system in C ++ using Detours to fix various memory allocation functions. When I get a call to malloc in addition to malloc, I also save stacktrace (so that I can point to a leak).
The only reliable way to get accurate stacking is to use StackWalk64 (I tried RtlCaptureStackBackTrace, and it only managed to stack very simple stacks).
However, here is my problem, StackWalk64 calls malloc, which in turn calls StackWalk64 and causes the stack to overflow. Now I may have a flag that deals with recursive calls, however this does not work with multiple threads
I was wondering if anyone has a possible solution to this pickle.
Thank you Rich Faceless
source share