From: Tom Tromey <tromey@redhat.com>
To: Thiago Jung Bauermann <bauerman@br.ibm.com>
Cc: gdb-patches ml <gdb-patches@sourceware.org>
Subject: Re: [RFC][python] Add support for convenience functions implemented in Python
Date: Wed, 04 Feb 2009 20:16:00 -0000 [thread overview]
Message-ID: <m3ljsmdklm.fsf@fleche.redhat.com> (raw)
In-Reply-To: <1233709654.14735.34.camel@localhost.localdomain> (Thiago Jung Bauermann's message of "Tue\, 03 Feb 2009 23\:07\:34 -0200")
>>>>> "Thiago" == Thiago Jung Bauermann <bauerman@br.ibm.com> writes:
Thiago> This is a new version of the patch
[...]
I have a couple little nits.
Also I want to point out the memory allocation oddities in this patch
... I am not super concerned by them but I would be interested in
other opinions, if there are any.
Thiago> diff --git a/gdb/parse.c b/gdb/parse.c
Thiago> index eee1f8e..dc2ccb1 100644
[...]
Thiago> - this is strictly for the convenience of debugging gdb itself. Gdb
Thiago> + this is strictly for the convenience of debugging gdb itself.
This is fine but it seems unrelated to this patch.
Thiago> + error(_("Error while executing Python code."));
Missing a space before the first "(".
Thiago> + error(_("Error while executing Python code."));
Likewise.
Thiago> +void
Thiago> +gdbpy_initialize_functions (void)
Thiago> +{
Thiago> + fnpy_object_type.tp_new = PyType_GenericNew;
Thiago> + fnpy_object_type.tp_init = fnpy_init;
Lately I am preferring to just put these directly into the global's
definition.
Thiago> +value_create_internal_function (const char *name,
[...]
Thiago> + /* The internal_function object is leaked here -- to make it truly
Thiago> + deletable, we would have to reference count it and add special
Thiago> + code to value_free and value_copy. The setup here is a bit odd
Thiago> + in general. It would be better to have a special case in
Thiago> + help_command. */
So, this is the primary memory leak. You can see it in action by
defining a convenience function, then assigning something else to the
variable. That is, if your function is $foo, invoking "set $foo = 0"
will leak the function definition.
I could implement the reference counting idea if this seems important
to anybody. I tend to doubt this will happen much -- it isn't common
to define a lot of convenience functions and it is even less common to
delete them.
Another idea would be to make them un-assignable.
Tom
next prev parent reply other threads:[~2009-02-04 20:16 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-02 13:16 Thiago Jung Bauermann
2009-02-02 19:49 ` Eli Zaretskii
2009-02-03 14:14 ` Thiago Jung Bauermann
2009-02-04 1:07 ` Thiago Jung Bauermann
2009-02-04 20:16 ` Tom Tromey [this message]
2009-03-05 22:47 ` Thiago Jung Bauermann
2009-03-18 2:25 ` Tom Tromey
2009-03-21 3:16 ` Thiago Jung Bauermann
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=m3ljsmdklm.fsf@fleche.redhat.com \
--to=tromey@redhat.com \
--cc=bauerman@br.ibm.com \
--cc=gdb-patches@sourceware.org \
/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