From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Cc: Keith Seitz <keiths@redhat.com>
Subject: Re: [RFA] c++/11734
Date: Tue, 22 Jun 2010 09:45:00 -0000 [thread overview]
Message-ID: <201006221045.23196.pedro@codesourcery.com> (raw)
In-Reply-To: <4C20103B.1080906@redhat.com>
No comments on the idea of the patch itself, just
a quick comment on something that made me stop for a second
while skimming your patch:
On Tuesday 22 June 2010 02:22:03, Keith Seitz wrote:
> + new = alloca (strlen (name));
Note that alloca in a loop in general isn't a good idea. The
stack memory added in each iteration is only released on function
exit, not on each iteration, so you're prone to stack overflow
given enough loops. It looks like `name' is invariant in
this loop, so you could for example, move the `new' declaration
out of the loop, initialized as NULL, and allocate it only once
on first need.
> + memcpy (new, name, paren - name);
> + new[name - paren] = '\0';
--
Pedro Alves
next prev parent reply other threads:[~2010-06-22 9:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-22 1:22 Keith Seitz
2010-06-22 9:45 ` Pedro Alves [this message]
2010-06-22 15:43 ` Keith Seitz
2010-06-23 17:33 ` Keith Seitz
2010-06-24 2:25 ` Doug Evans
2010-06-24 11:39 ` Matt Rice
2010-06-24 16:05 ` Doug Evans
2010-06-24 20:01 ` Tom Tromey
2010-06-24 20:49 ` Doug Evans
2010-06-24 20:51 ` Keith Seitz
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=201006221045.23196.pedro@codesourcery.com \
--to=pedro@codesourcery.com \
--cc=gdb-patches@sourceware.org \
--cc=keiths@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