delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2003/03/17/16:07:59

Message-ID: <3E762E23.A2F38193@yahoo.com>
Date: Mon, 17 Mar 2003 15:20:51 -0500
From: CBFalconer <cbfalconer AT yahoo DOT com>
Organization: Ched Research
X-Mailer: Mozilla 4.75 [en] (Win98; U)
X-Accept-Language: en
MIME-Version: 1.0
To: djgpp-workers AT delorie DOT com
Subject: Re: nmalloc revisited
References: <200303141601 DOT RAA26911 AT lws256 DOT lu DOT erisoft DOT se> <3E721051 DOT 645AA67D AT yahoo DOT com> <3E74B558 DOT 3629CBA9 AT yahoo DOT com> <1438-Sun16Mar2003203300+0200-eliz AT elta DOT co DOT il> <3E74E454 DOT BC734243 AT yahoo DOT com> <3E753E85 DOT 81830981 AT phekda DOT freeserve DOT co DOT uk> <3E755250 DOT 837B3606 AT yahoo DOT com> <3E75B36C DOT 6327581D AT phekda DOT freeserve DOT co DOT uk> <3E75E6E1 DOT A3989CD6 AT yahoo DOT com> <3E7616BC DOT E333FA24 AT phekda DOT freeserve DOT co DOT uk>
Reply-To: djgpp-workers AT delorie DOT com

Richard Dawe wrote:
> CBFalconer wrote:
> >
> [snip]
> 
> You said:
> 
> "I developed nmalloc to satisfy the well published and known standard
> interface, and got people screeching about failure to mate with other
> modules. I finally found a definition of those modules, and am even
> attempting to provide something close, but now you tell me those are
> for the inner-sanctum only and are not even published."
> 
> I was pointing out where you could get the the definition of the
> standard interface from: the code in CVS.

The standard interface is in the ISO standards document.  This is
the one thing that has to be met.  Has anyone run the existing
test mechanism?  This is what tnmalloc produces, with no
undocumented interface, and getting the magic values dynamically
from sysquery:

[1] c:\c\malloc>tnmalloc
test00-10
Usage: tnmalloc [testnumber [quantity [quiet]]]
fakearea at 12a14 through 14009a (was f594)
CHAR_BIT * sizeof(size_t) = 32
sysinfo is: nil = 10c44
    DATAOFFSET  = 16
    gdlo offset = 255
    sz   offset = 8
    prvf offset = 16
    nxtf offset = 12
    nxt  offset = 4
    prv  offset = 0
    ohead       = 20
    &freehdrs   = 10c40
Test Purpose
  1  malloc only
  2  malloc and free
  3  malloc(random), free, aborts for odd quantity
  4  malloc(random), realloc(random), and free
  5  malloc(10 random), realloc(10 random) and free 10
  6  realloc(random), monitor free lists
  7  realloc(random), check data unharmed
  8  run a long faked sequence, not complete
  9  run a long faked sequence, not complete
Any entry for quiet suppresses free list dumps

and here is the process for ensuring that proper alignment occurs:

[1] c:\c\malloc>tnmalloc 1 6
test01-6
malloc(    1) [   24]
  lastsbrk NULL
  freelist search from bucket 5, none found, extending sbrk
=>sbrk(1024=0x00400) got UNEXPECTED 12a15/0 lastsbrk 0 sz 0, szerr
3/5
  split returns 12a18 sz=24 nxt=12a30 prv=0 nxtf=0
returns 12a28(8)
malloc(   65) [   88]
  lastsbrk 12a30 sz=997 nxt=0 prv=12a18 nxtf=0
  freelist search from bucket 7, none found
  split returns 12a30 sz=88 nxt=12a88 prv=12a18 nxtf=0
returns 12a40(72)
malloc(  130) [  152]
  lastsbrk 12a88 sz=909 nxt=0 prv=12a30 nxtf=0
  freelist search from bucket 8, none found
  split returns 12a88 sz=152 nxt=12b20 prv=12a30 nxtf=0
returns 12a98(136)
malloc(  195) [  216]
  lastsbrk 12b20 sz=757 nxt=0 prv=12a88 nxtf=0
  freelist search from bucket 8, none found
  split returns 12b20 sz=216 nxt=12bf8 prv=12a88 nxtf=0
returns 12b30(200)
malloc(  260) [  280]
  lastsbrk 12bf8 sz=541 nxt=0 prv=12b20 nxtf=0
  freelist search from bucket 9, none found
  split returns 12bf8 sz=280 nxt=12d10 prv=12b20 nxtf=0
returns 12c08(264)
malloc(  325) [  344]
  lastsbrk 12d10 sz=261 nxt=0 prv=12bf8 nxtf=0
  freelist search from bucket 9, none found, extending sbrk
  sbrk(1027=0x00403) got expected 12e15 lastsbrk 12d10 sz 261
  split returns 12d10 sz=344 nxt=12e68 prv=12bf8 nxtf=0
returns 12d20(328)

I put this all out there, complete with the tests, so people could
evaluate it and complain if it was lacking in some manner, WITH
RESPECT TO ISO standards. I have heard not one word about this
fundamental compliance (or lack) from anyone.  Martin S seems to
have quietly mounted it in his system, and apparently had no
trouble except with these non-standard interfaces. 

I find DJGPP to be a fundamentally good and reasonably efficient
system.  I saw a glaring flaw, and rather than bitch incessantly,
I fixed it with, I believe, sound and clear code.  Apparently very
few care to even look at the result.

I am still willing to take a shot at a near compatible debug
interface, as I proposed with a previous message (see the
malldbg.h header).

-- 
Chuck F (cbfalconer AT yahoo DOT com) (cbfalconer AT worldnet DOT att DOT net)
   Available for consulting/temporary embedded and systems.
   <http://cbfalconer.home.att.net>  USE worldnet address!


- Raw text -


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