delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/09/28/11:59:36

From: alainm AT news DOT RISQ DOT QC DOT CA (Alain Magloire)
Subject: Re: problem with malloc.c attn: Michael Bukin and Eli Zaretskii
Newsgroups: comp.os.msdos.djgpp
References: <Pine DOT SUN DOT 3 DOT 91 DOT 990928093722 DOT 17309L-100000 AT is>
X-Newsreader: TIN [version 1.2 PL2]
Lines: 38
Message-ID: <yu4I3.13392$j6.105882@carnaval.risq.qc.ca>
Date: Tue, 28 Sep 1999 14:43:42 GMT
NNTP-Posting-Host: 132.206.63.174
X-Complaints-To: abuse AT mcgill DOT ca
X-Trace: carnaval.risq.qc.ca 938529822 132.206.63.174 (Tue, 28 Sep 1999 10:43:42 EDT)
NNTP-Posting-Date: Tue, 28 Sep 1999 10:43:42 EDT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Eli Zaretskii (eliz AT is DOT elta DOT co DOT il) wrote:

: You need to fix your code to avoid calling `free' more than once.

: > It is an absurd situation.
: > Other compilers, such as the Watcom C/C++ compiler, and indeed the
: > Delorie port of the gnu compiler with the old malloc.c, have no trouble.
: > Why should the Delorie port of the gnu compiler with the new malloc.c?

??
You run this type of hack on a Un*x box it will send you
crashing and burning with a sigvec or sigbus.

...

: I don't know how do other compilers implement malloc/free, but a buggy
: application code (yours) invokes what's called ``undefined behavior'',
: which in English means ``anything can happen''.

Absolutely, some implementation can use a free list of memory pool
and calling free() twice, will muck up the free list.  If you are lucky
it will crash in the free() and it this case it is easy to see, in
the worst case scenario, the memory allocator is corrupted and you have
runaway pointers.  Usually the application will crash when you're
doing a demo or a conference, sending bad vibes down your spin ;-)
and your bonus check to oblivion.  I know .. I've been there.

: The right way to solve this is to fix your code, not to blame the
: library for misbehaving when you violate the rules of the game.

8-) [laughs] this is normal programmers reflexes, the first thing
is to blame, anything but your code(the ABTC syndrome)
the second is the ubiquitous : "It used to work before !"

--
au revoir, alain
----
Aussi haut que l'on soit assis, on est toujours assis que sur son cul !!!

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019