This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [RFA] Move alloca(0) to wait_for_inferior() from registers_changed()


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]