I am trying to improve the performance of my C++ program and I found that converting memory allocations (mallocs) into object pool is giving great results. The problem is detecting the places from which malloc is called, since the code base is quite large. I can't use simple gdb with break points because there are many timers and signal handlers running in parallel.
Is there a way in gdb using which I can print the entire stack trace whenever malloc is called without having to do it manually each time. OR Can you suggest any other tool which will help me do the same.