From: Phil Muldoon <pmuldoon@redhat.com>
To: Project Archer <archer@sourceware.org>
Cc: themastermind1@gmail.com
Subject: Re: [patch] fixing leaking struct value* in py-value.c
Date: Tue, 12 Jan 2010 11:22:00 -0000 [thread overview]
Message-ID: <4B4C5B55.6060303@redhat.com> (raw)
In-Reply-To: <e1c05edd0912101515v41e2fd54l75287580989710a2@mail.gmail.com>
On 12/10/2009 11:15 PM, Aman Gupta wrote:
> The gdb process will leak a large amount of memory (>512mb RSS) while
> executing the python loop. Some (but not all) of this memory is
> returned after the loop completes and free_all_values() is called for
> the next command. The following patch against archer-tromey-python
> keeps the memory usage constant during the loop.
On my tests, the consumption noted is far in excess of that, so good
find.
>
> diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c
> index 14efd79..f305b01 100644
> --- a/gdb/python/py-value.c
> +++ b/gdb/python/py-value.c
> @@ -143,7 +143,7 @@ valpy_new (PyTypeObject *subtype, PyObject *args,
> PyObject *keywords)
Your mailer appears to be wrapping patches. So this means the patch
command will complain of a malformed patch. In this case it was
easily fixed in an editor, but a heads up in any case.
> #define GDB_PY_HANDLE_EXCEPTION(Exception) \
> + GDB_PY_HANDLE_EXCEPTION_AND_CLEANUP(Exception, NULL)
> +
> +#define GDB_PY_HANDLE_EXCEPTION_AND_CLEANUP(Exception, mark) \
> do { \
> - if (Exception.reason < 0) \
> + if (Exception.reason < 0) { \
> + if (mark) \
> + value_free_to_mark (mark); \
> return PyErr_Format (Exception.reason == RETURN_QUIT \
> ? PyExc_KeyboardInterrupt : PyExc_RuntimeError, \
> "%s", Exception.message); \
> + } \
> } while (0)
When I try to compile against archer-tromey-python with:
../archer/configure && make CFLAGS="-O0 -g3"
I get a compile error:
cc1: warnings being treated as errors
../../archer/gdb/python/py-symbol.c: In function ‘gdbpy_lookup_symbol’:
../../archer/gdb/python/py-symbol.c:200: error: implicit declaration of function ‘value_free_to_mark’
make[2]: *** [py-symbol.o] Error 1
This is because GDB_PY_HANDLE_EXCEPTION is used in many sources files,
and value_free_to_mark is defined in value.{h|c}. And as you've
taken over the definition of GDB_PY_HANDLE_EXCEPTION the substitution
has some side-effects. So this needs to be fixed first.
Did you spot or note any regressions from a full test run by comparing
the gdb.sum files before and after the patch? A note indicating the
platform/architecture of testing, and any regressions spotted would be
great, thanks.
Also, this patch needs a ChangeLog.
Cheers,
Phil
next prev parent reply other threads:[~2010-01-12 11:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-10 23:16 Aman Gupta
2010-01-12 11:22 ` Phil Muldoon [this message]
[not found] ` <AANLkTi=qwg88TbawxPcKSk+iMZwz9aB_L3oqyaEe32Yc@mail.gmail.com>
2010-11-04 19:43 ` Aman Gupta
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B4C5B55.6060303@redhat.com \
--to=pmuldoon@redhat.com \
--cc=archer@sourceware.org \
--cc=themastermind1@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).