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?


On Mon, Nov 13, 2000 at 06:13:49AM -0500, Eli Zaretskii wrote:
> > From: Michael Meissner <meissner@cygnus.com>
> > Date: Sun, 12 Nov 2000 20:00:34 -0500
> > 
> > For malloc overruns, I typically just link in with -lefence or other
> > tools, and it is fairly obvious where the bug is.
> 
> Except that there are programs where using Efence or similar tools is
> impractical, because these libraries typically don't free memory when
> the application calls `free' (to catch code which writes into free'd
> memory).  This enlarges the memory footprint of such programs to the
> extent that you cannot link with -lefence, because the program won't
> run for more than a few moments, or not at all.

Yes I know, I assumed that would be obvious, particularly with efence which
allocates 2 pages per malloc request.  Its part of the reason why I have 1+
gigs of swap space on this machine, and will probably go to 2 or more the next
time I reogranize the disks.

> I'd expect GDB to be one of the programs where this approach is not
> very practical, what with all the malloc'ing that goes on there.

In terms of GCC, it tended to be obstacks that caused the most grief, because
they didn't work well with malloc checkers.  Fortunately, obstacks are mostly a
thing of the past these days in the compiler.

> In fact, we have such an elusive memory problem right now in Emacs
> development sources.  It's been a couple of months since it was first
> reported, and all of the Emacs developers have been hunting it ever
> since, including lots of special-purpose code that was written
> specifically for catching that bug.  The bug is still at large...

Bummer....

-- 
Michael Meissner, Red Hat, Inc.
PMB 198, 174 Littleton Road #3, Westford, Massachusetts 01886, USA
Work:	  meissner@redhat.com		phone: +1 978-486-9304
Non-work: meissner@spectacle-pond.org	fax:   +1 978-692-4482

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