Showing results for 
Search instead for 
Did you mean: 

gdb, to profile heap usage of an app

Occasional Advisor

gdb, to profile heap usage of an app


There is a process, a stub basically, which further loads up a zillion shared libs while in execution.

To profile the heap usage(growth/decline) of this process over a period of time and upon certain critical points, gdb seems to be a better option.

Need pointers, to how one could have gdb attached to this process in execution, made to dump heap reports periodically (to a file), also, dump heap reports on reaching specific breakpoints (a list of critical functions, simply); all while the process still being alive.

Even a simple script that invokes gdb, attaches it to a pid, dumps a heap profile report and then detaches gdb, letting the process run as it was; would help. Please provide pointers to gdb options / possibilities in this regard.

Will attaching gdb to this process have any kind of impact on the exe in execution?

Please provide pointers/details for the above query.

Thanks && regards!
Occasional Visitor

Re: gdb, to profile heap usage of an app

You could use gdb for application heap/leak

Please visit

please go through the white paper

please go through the section "Supported Modes of Memory-debugging in WDB"
and "Debugging in Attach Mode" in the white paper.