From: Tom Tromey <tom@tromey.com>
To: Pedro Alves <palves@redhat.com>
Cc: Tom Tromey <tom@tromey.com>, gdb-patches@sourceware.org
Subject: Re: [RFA] Use unique_xmalloc_ptr in Python code
Date: Wed, 09 Nov 2016 23:41:00 -0000 [thread overview]
Message-ID: <87lgws5iks.fsf@tromey.com> (raw)
In-Reply-To: <71852739-1e5c-6be8-eb21-822c67bc0ea9@redhat.com> (Pedro Alves's message of "Wed, 9 Nov 2016 23:20:33 +0000")
>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
Pedro> IMO, for simplicity sake, we should default to use std::string, unless
Pedro> we're ending up storing the result in some long lived objects where
Pedro> memory really is a concern (because of many instances), and a final
Pedro> string dup/copy to destination wouldn't be too heavy too. I doubt
Pedro> that's the case here, but it's not easy to see without trying.
Pedro> Did you try a std::string approach first?
Nope, I had just started with unique_xmalloc_ptr, and then noticed a few
spots -- basically anywhere in the patch calling .release() -- where the
ownership is passed on.
I didn't really consider that copying the string would be ok. I agree
it is, I think I was just being conservative in preserving existing
behavior.
Pedro> In any case, this is strictly an improvement, so OK with me. Please
Pedro> push. Let's get this out of the way of your py-ref series.
Pedro> We can convert to std::string at some other point, if desirable.
Will do. Thanks.
Tom
prev parent reply other threads:[~2016-11-09 23:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-04 20:42 Tom Tromey
2016-11-09 23:20 ` Pedro Alves
2016-11-09 23:41 ` Tom Tromey [this message]
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=87lgws5iks.fsf@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.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