This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Large memory usage by gdb
- From: Philippe Waroquiers <philippe dot waroquiers at skynet dot be>
- To: Alex Lindsay <alexlindsay239 at gmail dot com>
- Cc: gdb at sourceware dot org
- Date: Tue, 25 Jul 2017 22:28:58 +0200
- Subject: Re: Large memory usage by gdb
- Authentication-results: sourceware.org; auth=none
- Ironport-phdr: 9a23:MBkkxB+H3X4NBf9uRHKM819IXTAuvvDOBiVQ1KB30+IcTK2v8tzYMVDF4r011RmSDNWds6oMotGVmpioYXYH75eFvSJKW713fDhBt/8rmRc9CtWOE0zxIa2iRSU7GMNfSA0tpCnjYgBaF8nkelLdvGC54yIMFRXjLwp1Ifn+FpLPg8it2e2//57ebx9UiDahfLh/MAi4oQLNu8cMnIBsMLwxyhzHontJf+RZ22ZlLk+Nkhj/+8m94odt/zxftPw9+cFAV776f7kjQrxDEDsmKWE169b1uhTFUACC+2ETUmQSkhpPHgjF8BT3VYr/vyfmquZw3jSRMNboRr4oRzut86ZrSAfpiCgZMT457HrXgdF0gK5CvR6tuwBzz4vSbYqINvRxY7ndcMsZS2RcXshfSSJPDYGyb4QTCOQOMulWopLhp1YMtxayGROhCP/txzJOm3T43bc60+MkEQzexgIgH9MOsHDVrNXtLKcdT/2+w6nSwjXZaPNWwCr96InWfRA7uvGHQLV9cdLRyUkuEwPFj02QqZT7MD+P2OUCqXKb7+15VeKyim4otRtxoiO0y8c3iYnIhoQVxU7Y9Slj24k6O8S1RUhmatCnCJtdryKXOolsTs4jQ2xkojs2xqEJtJKhciUHyZIqzAPFZfOdaYiH+BfjWf6UITd/mX1qZqqyhw238Ui80u38UdS00EpSoipFjNbMsncN2gTW6seaUvd9/0Gh1iiT1w3L6exJI1o4mKvbJpI737I8ipUevV7NEyL3gEn2ibWZdkQg+uim8eTnZbDmq4eEN490iwH+NqUumtSnAesmKAQPUXKU+f671L364E35QatFjuctkqTCq5DaJsQapqinDA9JyIos8AiwAy+80NsEhXkHME5FeBWfgofzP1HBPv/5DfO+g1SqjThr3OrJP73/DpjDKnXOi7jhfbNn5E5dzAo/18xQ55VRCuJJHPWmc0v8pJT8Dxk1KAWli7LuDNht0oIYVXmGE/XCYYvdtFaJ4qQkJOzaN6EPvzOoE/gk4//2lXJxplYHerC03JYNczjsBvRnJ0SBeXeqnd4bFn4XvwckV8Txi0yEXCIVbXvkDPF03S0yFI/zVdSLfYuqmrHUmX7jRpA=
- References: <8d511930-9914-9aef-363f-2fff37dfc6a8@gmail.com>
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