This is the mail archive of the gdb@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: alloca is bad?


> Date: Thu, 9 Nov 2000 22:22:31 -0500
> From: Christopher Faylor <cgf@redhat.com>
> 
> You can, of course, have array overruns with an alloca'ed buffer just
> like you can with a malloced array.

IMHO, buffer overruns are irrelevant to this issue, since they happen
with automatic arrays as well, and are equally hard (or simple) to
track.

> Hmm.  I think that Purify actually does help track down stack corruption
> so there is at least one tool for this.  I've never used Electric Fence
> but I would be surprised if it was completely trivial to use and I would
> be equally surprised if linking with Electric Fence automatically
> pinpointed heap problems in every case.

You are right, as long as my experience goes.  Malloc debuggers are
anything but trivial to use, and some large programs which allocate
memory all the time, such as Emacs, are practically impossible to
debug using these tools, at least those of them which use page
protection to catch buffer overruns.

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