This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA] Move alloca(0) to wait_for_inferior() from registers_changed()
- To: Nick Duffek <nsd at redhat dot com>
- Subject: Re: [RFA] Move alloca(0) to wait_for_inferior() from registers_changed()
- From: Fernando Nasser <fnasser at cygnus dot com>
- Date: Thu, 14 Dec 2000 13:52:49 -0500
- CC: cagney at redhat dot com, gdb-patches at sources dot redhat dot com
- Organization: Red Hat , Inc. - Toronto
- References: <3A38F8F3.7836222B@cygnus.com> <200012141658.eBEGwaa02725@rtl.cygnus.com>
Nick Duffek wrote:
>
> On 14-Dec-2000, Fernando Nasser wrote:
>
> >Doesn't matter the number. At each time someone calls alloca() the garbage
> >collection is done. So, only the last iteraction counts.
>
> Wrong. If a single alloca() happens at the same stack depth multiple
> times, as is quite likely when doing watchpoint checks, garbage collection
> won't occur.
>
Yes, if you have alloca() at only one level and repeatedly call it it will
accumulate things.
This is a good example where alloca() should not be used.
Instead of trying to fit a alloca(0) somewhere, it would be better to get
rid of the alloca() in this code.
--
Fernando Nasser
Red Hat - Toronto E-Mail: fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario M4P 2C9