malloc: bug or feature ?
peter at wemm.org
Wed Apr 7 08:39:09 PDT 2004
On Wednesday 07 April 2004 05:55 am, Marc Olzheim wrote:
> On Wed, Apr 07, 2004 at 02:39:53PM +0200, Georges-Andre Silber wrote:
> > Is it a 'normal' behaviour of malloc()? Shouldn't malloc() return
> > NULL?
> It should return NULL indeed. I can reproduce this on my -CURRENT
> machine, while 5.2.1-RELEASE is ok.
In -current, this is normal. The default MALLOC_OPTIONS setting is
'AJ', which intentionally fills new malloc'ed data area with junk, and
has all the assertions turned on.
The SEGV looks suspicious though. I wonder if malloc is trying to put
the junk in without checking if malloc failed.
Anyway, try "env MALLOC_OPTIONS=aj ./a.out" See 'man malloc.conf' etc
for more info.
Peter Wemm - peter at wemm.org; peter at FreeBSD.org; peter at yahoo-inc.com
"All of this is for nothing if we don't go to the stars" - JMS/B5
More information about the freebsd-amd64