Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 Apr 2004 08:37:43 -0700
From:      Peter Wemm <peter@wemm.org>
To:        freebsd-amd64@freebsd.org
Subject:   Re: malloc: bug or feature ?
Message-ID:  <200404070837.43253.peter@wemm.org>
In-Reply-To: <20040407125532.GA75228@stack.nl>
References:  <4073F699.6010402@cri.ensmp.fr> <20040407125532.GA75228@stack.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
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@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com
"All of this is for nothing if we don't go to the stars" - JMS/B5



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