Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Sep 1997 23:06:16 -0700
From:      John-Mark Gurney <gurney_j@efn.org>
To:        Peter Wemm <peter@spinner.dialix.com.au>
Cc:        Andrew Atrens <atrens@nortel.ca>, hackers@FreeBSD.ORG, gram@cdsec.com, phk@critter.freebsd.dk, freebsd-bugs@FreeBSD.ORG
Subject:   Re: Bug in malloc/free
Message-ID:  <19970918230616.02227@hydrogen.nike.efn.org>
In-Reply-To: <199709190459.MAA07378@spinner.dialix.com.au>; from Peter Wemm on Fri, Sep 19, 1997 at 12:59:33PM %2B0800
References:  <199709190401.VAA06335@hub.freebsd.org> <199709190459.MAA07378@spinner.dialix.com.au>

next in thread | previous in thread | raw e-mail | index | archive | help
Peter Wemm scribbled this message on Sep 19:
> "Andrew Atrens" wrote:
> > 
> > Hi Folks,
> > 
> > By coincidence I *may* have seen a bug similar to Graham's last night...
> > I'm using 3.0 current ( circa. Aug 08 ).
> > 
> > I built `ddd-2.1.1.tar.gz', found in /pub/FreeBSD/distfiles which is a
> > largely C++ interface for gdb and others. Unfortunately, when I tried to
> > run it, it gobbled memory until it choked. I tried a second time, this
> > time killing it with CTRL-C and observed:
> > 
> > ^Cddd in malloc(): warning: recursive call.
> > Virtual memory exceeded in `new'
> > 
> > After reading Graham's thread I relinked it against libgnumalloc, and low
> > and behold it works like a charm !
> > 
> > Does this point to an incompatibility problem between phkmalloc and g++
> > compiled code ?
> 
> Hmm, this particular thing sounds like a signal recursion problem..
> 
> If a malloc() instance is interrupted in the middle of execution and a
> signal is taken, and that signal again calls malloc (eg: via new), the
> state of the malloc arena is 'indeterminate'.
> 
> Perhaps malloc is doing something that can cause a signal?  or perhaps ddd
> has a fast timer that calls malloc (or new) that can interrupt other malloc
> calls?  Perhaps malloc() could/should block SIGALRM while executing it's 
> non-reentrant parts?

I thought that you weren't suppose to call routines like these from
signal handlers...  and from the APUE (page278): "Most functions that
are not in Figure 10.3 [Reentrant functions that may be called from a
signal handler] are missing because (a) they are known to use static
data structures, (b) they call malloc or free, or (c) they are part of
the standard I/O library."  so any program that makes calles to these
functions are VERY broken...

-- 
  John-Mark Gurney                          Modem/FAX: +1 541 683 6954
  Cu Networking

  Live in Peace, destroy Micro$oft, support free software, run FreeBSD



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19970918230616.02227>