Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Jan 1996 09:22:03 -0800
From:      John Polstra <jdp@polstra.com>
To:        jmz@cabri.obs-besancon.fr
Cc:        freebsd-current@freebsd.org
Subject:   Re: c++ and malloc
Message-ID:  <199601221722.JAA15652@austin.polstra.com>
In-Reply-To: <9601210225.AA20119@cabri.obs-besancon.fr>

next in thread | previous in thread | raw e-mail | index | archive | help
In article <9601210225.AA20119@cabri.obs-besancon.fr> you write:
> On a current system, c++ programs generate a lot of warnings. Here is
> a simple example:
> $ cat a.cc
> #include <fstream.h>
> ofstream x; main () {}
> $ c++ a.cc
> $ a.out
> Malloc warning: free(): already free chunk.
> Malloc warning: free(): already free chunk.
> Malloc warning: free(): already free chunk.

This might possibly be caused by a library problem that I caused with
a change I made to /usr/share/mk/bsd.lib.mk.  Check that file, and see
whether you have revision 1.28.  That is the bad version.  If you have
it, you should get the newest version (1.29), or revert to the preceding
version (1.27), or just apply this patch:

-------------------------------------------------------------------------------
Index: src/share/mk/bsd.lib.mk
diff -c src/share/mk/bsd.lib.mk:1.28 src/share/mk/bsd.lib.mk:1.29
*** src/share/mk/bsd.lib.mk:1.28	Tue Jan 16 16:03:08 1996
--- src/share/mk/bsd.lib.mk	Sun Jan 21 09:26:25 1996
***************
*** 1,5 ****
  #	from: @(#)bsd.lib.mk	5.26 (Berkeley) 5/2/91
! #	$Id: bsd.lib.mk,v 1.28 1996/01/17 00:03:08 jdp Exp $
  #
  
  .if exists(${.CURDIR}/../Makefile.inc)
--- 1,5 ----
  #	from: @(#)bsd.lib.mk	5.26 (Berkeley) 5/2/91
! #	$Id: bsd.lib.mk,v 1.29 1996/01/21 17:26:25 jdp Exp $
  #
  
  .if exists(${.CURDIR}/../Makefile.inc)
***************
*** 187,193 ****
  .endif
  
  .if !defined(NOPIC)
! .if !make(clean) && !make(cleandir)
  SOBJS+= ${DESTDIR}/usr/lib/c++rt0.o
  .endif
  
--- 187,193 ----
  .endif
  
  .if !defined(NOPIC)
! .if defined(CPLUSPLUSLIB) && !make(clean) && !make(cleandir)
  SOBJS+= ${DESTDIR}/usr/lib/c++rt0.o
  .endif
  
-------------------------------------------------------------------------------

Then, rebuild all of your shared libraries.  You don't have to recompile
them; just redo the final "ld" steps that build the libraries.

I don't know whether this is the cause of your problem or not; but it
might be.

-- John
-- 
   John Polstra                                       jdp@polstra.com
   John D. Polstra & Co., Inc.                Seattle, Washington USA
   "Self-knowledge is always bad news."                 -- John Barth



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