www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/11/29/14:46:53

From: "John S. Fine" <johnfine AT erols DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Djgpp doesn't free the memory? What am I doing wrong?
Date: Sat, 28 Nov 1998 15:58:56 -0500
Lines: 42
Message-ID: <36606410.351A@erols.com>
References: <36594f0d DOT 209084 AT news DOT jet DOT es> <365F0263 DOT 27D0 AT erols DOT com> <365fdc75 DOT 11836619 AT news DOT jet DOT es>
Mime-Version: 1.0
X-Trace: FsbdgYAFOEVuTo93MQKN3Ee78g/HQdO3nHz5+Ec9uw0=
X-Complaints-To: abuse AT rcn DOT com
NNTP-Posting-Date: 28 Nov 1998 20:59:52 GMT
X-Mailer: Mozilla 3.01 (Win95; U)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Grzegorz Adam Hankiewicz wrote:

> not solved this, and to the moment of writting this nobody answered

> >  There must be an expert here who knows what is going on, but
> >I sure don't.  Your code looks correct and on my machine it
> >fails as you described.

  Now that I found the answer, I am surprised it is not in the
FAQ (or is it there and I somehow missed it?)

> >  What version of the lib*.a files are you using?  (When I
> >figure out which version *I* am using, I may look at the
> >malloc source code for clues.

> Accordingly I have installed bnu281b.zip, gcc281b.zip, djdev201.zip,

   The malloc in libc.a in djdev201.zip seems to come from
malloc.c in djlsr201.zip.

   In the source code, the restriction is very clear.  Memory is
allocated in fixed chunks and those chunks are never split and
never combined.  If you ask for 1048576, you get 1052668
(preceeded by 4 bytes overhead).  When you release it, it can
be reallocated as any size from 528381 to 1052668;  But it can
never be used for any other size.

   There are other GNU malloc.c routines that you could use.
I just searched my own hard drive (not even the web) and found
a free-source malloc.c in lgp271s.zip (which I had downloaded,
I forget when, from Simtel).

   I simply included that malloc.c in the gcc command to build
your program and the result worked perfectly.  I did not need
to use any other part of lgp271s.zip.

(If I understood your comment earlier, you DO NOT want the
copy-by-email that I normally send when replying in a
newsgroup.)
-- 
http://www.erols.com/johnfine/
http://www.geocities.com/SiliconValley/Peaks/8600/

- Raw text -


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