Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Oct 2002 21:09:45 -0500
From:      Dan Nelson <dnelson@allantgroup.com>
To:        Scott Pilz <tech@tznet.com>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: malloc
Message-ID:  <20021018020945.GA91928@dan.emsphone.com>
In-Reply-To: <20021017203931.E96249-100000@mail.tznet.com>
References:  <20021017203931.E96249-100000@mail.tznet.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Oct 17), Scott Pilz said:
> 	This is almost depressing...
> 
> What would cause:
> 
> in free(): warning: junk pointer, too high to make sense
> 
> (more so, is there a way to "fix" this, not what would cause this)
> 
> from happening on a rare program that works well on other operating
> systems, just not BSD (yes it is using malloc)?

That means the program is trying to free a pointer higher in memory
than the highest pointer malloc() has ever allocated.  It's a good sign
that the program is doing something it shouldn't.
 
> I'd really hate to have to switch one of my machines to Redhat to make
> certain applications run.

It is only a warning, and will not cause the program to crash.  You
might be able to mask the message by setting the MALLOC_OPTIONS
variable to match the behavior of your other systems (see the malloc
manpage for all the flags).  Try "Z" (useful if a program mallocs
memory and assumes it's zero), or "jz" (useful if the program tries to
use memory after it has called free() ).

The correct fix, of course, is to set MALLOC_OPTIONS="A", and use the
resulting coredump to fix the program :)

-- 
	Dan Nelson
	dnelson@allantgroup.com

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




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