From: Tom Tromey <tromey@redhat.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: Pedro Alves <palves@redhat.com>, gdb-patches@sourceware.org
Subject: Re: RFC: introduce scoped cleanups
Date: Wed, 05 Jun 2013 17:44:00 -0000 [thread overview]
Message-ID: <87wqq8ih9u.fsf@fleche.redhat.com> (raw)
In-Reply-To: <20130603060716.GC12363@adacore.com> (Joel Brobecker's message of "Mon, 3 Jun 2013 10:07:16 +0400")
Joel> A very valid concern, IMO! I've never seen heap allocation as
Joel> a reason for concern with respect to performance, and thus have
Joel> never hesitated calling malloc. The only reason I have prefered
Joel> alloca whenever possible is that it allows me to be lazy :-)!
It doesn't happen much, but you can see a few spots where someone coded
around the malloc call -- the various conditional cleanups that my
series removed.
Joel> But this made me realize something: Why would someone want to do
Joel> stack-cleanups instead of just calling alloca directly? Since
Joel> alloca is basically a call-and-forget, what's the advantage of
Joel> going through a stack-based cleanup?
It is the difference between running the cleanup and freeing the memory
that is used by the cleanup object itself.
Joel> Regardless of the above, I like the idea of performing the cleanups
Joel> on an obstack; fast and yet a little more resilient to programming
Joel> errors. Not sure if that would be something easy to implement or not,
Joel> though.
It ought to be easy. I will look into it.
Tom
next prev parent reply other threads:[~2013-06-05 17:44 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-09 18:56 Tom Tromey
2013-05-30 20:09 ` Tom Tromey
2013-05-31 6:11 ` Joel Brobecker
2013-05-31 15:56 ` Tom Tromey
2013-05-31 16:15 ` Pedro Alves
2013-05-31 20:24 ` Tom Tromey
2013-06-03 6:07 ` Joel Brobecker
2013-06-05 17:44 ` Tom Tromey [this message]
2013-07-16 20:33 ` Tom Tromey
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=87wqq8ih9u.fsf@fleche.redhat.com \
--to=tromey@redhat.com \
--cc=brobecker@adacore.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