This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Large memory usage by gdb

On Mon, 2017-07-31 at 17:11 -0500, Alex Lindsay wrote:
> Philippe,
> Is memcheck a better tool to use here compared to massif?
In valgrind 3.13, memcheck provides a quite detailed/precise
way to see delta memory increase/decrease.
Typically, you will give --xtree-memory=full argument,
and then e.g. use vgdb to launch a (delta) leak search
after each run.
You can then use kcachegrind to visualise the resulting
memory increase.

Massif is IMO less precise, but automatically produces
memory status at regular interval.

So, in summary, I would use valgrind 3.13 and memcheck
(with an additional benefit that if ever your use case
causes real memory leaks, memcheck will detect them).


> Alex
> On 07/25/2017 03:28 PM, Philippe Waroquiers wrote:
> > Run gdb under Valgrind, and make some heap profiling dump at regular
> > interval, (e.g. after each run).
> >
> > With valgrind 3.12 or before, you can do a leak report to show
> > the delta (increase or decrease) compared to the previous leak search,
> > including the reachable blocks. So, you will be able to see what
> > increases the memory.
> >
> > If you compile the latest Valgrind (3.13), you can e.g. use memcheck
> > and produce heap profiling reports readable with kcachegrind.
> >
> > You will need a gdb compiled with debug or install the debug info
> > of gdb to have understandable stack traces.
> >
> > Philippe
> >
> > On Tue, 2017-07-25 at 15:20 -0500, Alex Lindsay wrote:
> >> My OS is Ubuntu 17.04. Using both gdb 7.12 and 8.0, I experience large
> >> memory usage when debugging my executable. As I add breakpoints and run
> >> the executable multiple times in a single session, memory usage grows
> >> continuously, regularly hitting 10s of GBs. I don't recall experiencing
> >> this issue with earlier Ubuntu versions (and also likely earlier
> >> versions of gdb). When I debug the same executable with `lldb`, memory
> >> usage is pretty much constant at around 2 GB. Does anyone have any
> >> suggestions?
> >>
> >> Alex
> >

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]