backward-cpp icon indicating copy to clipboard operation
backward-cpp copied to clipboard

Load stack trace into user-provided storage

Open drew-gross opened this issue 9 months ago • 1 comments

Current, backward loads a stack trace into a std::vector that is resized inside load_here.

I'm working on optimizing some of our code involving stack traces and I'd like to be able to eliminate this allocation, by providing pre-allocated memory of my own (most likely stack memory, but also potentially heap memory allocated from a pool). What do you think it would take to refactor the code to allow this? Any suggestions for how to go about it, or any potential pitfalls?

drew-gross avatar Oct 20 '23 02:10 drew-gross

Damn this is tough. This vector is pretty well rooted in there. I don't have any smart idea at the moment. I will try to think of something.

On Thu, Oct 19, 2023, 19:21 Drew @.***> wrote:

Current, backward loads a stack trace into a std::vector https://github.com/bombela/backward-cpp/blob/65a769ffe77cf9d759d801bc792ac56af8e911a3/backward.hpp#L800 that is resized inside load_here https://github.com/bombela/backward-cpp/blob/65a769ffe77cf9d759d801bc792ac56af8e911a3/backward.hpp#L878-L880 .

I'm working on optimizing some of our code involving stack traces and I'd like to be able to eliminate this allocation, by providing pre-allocated memory of my own (most likely stack memory, but also potentially heap memory allocated from a pool). What do you think it would take to refactor the code to allow this? Any suggestions for how to go about it, or any potential pitfalls?

— Reply to this email directly, view it on GitHub https://github.com/bombela/backward-cpp/issues/318, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABUZDCRNBHTC6BME63ZSD3YAHNZVAVCNFSM6AAAAAA6IFAD3CVHI2DSMVQWIX3LMV43ASLTON2WKOZRHE2TGMZXGQYTCNY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

bombela avatar Oct 20 '23 07:10 bombela