delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2002/02/28/05:02:54

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-workers-bounces using -f
Message-ID: <3C7DFD48.817C5A6D@yahoo.com>
Date: Thu, 28 Feb 2002 04:50:00 -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: Malloc/free DJGPP code
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1020227073846 DOT 19787B-100000 AT is> <3C7D4C39 DOT 2B68622E AT yahoo DOT com>
Reply-To: djgpp-workers AT delorie DOT com

I have added the following section:

/* This allows a clean connection to debugging software */
static struct sysquery {
   byte      values[8];
   memblockp nil;
} sysquery    = { { DATAOFFSET,
                    offsetof(memblock, guardlo),
                    offsetof(memblock, sz),
                    offsetof(memblock, prevfree),
                    offsetof(memblock, nextfree),
                    offsetof(memblock, next),
                    offsetof(memblock, prev),
                    0     /* reserved for expansion */
                  },
                  NONE
};

/* This can return the above values, hopefully in a register */
/* The use of NONE in nextfree, prevfree may cause confusion */
/* Maybe the value of NONE should be a further field??       */
struct sysquery _sysmalloc(void)
{
   return sysquery;
} /* _sysmalloc */

The idea is to provide an easy controlled system interface to
debugging tools that have to follow the allocation chains and
sizes around.  That is why I have put the routine in the system
name space.

With a few other changes it compiles with NDEBUG defined to create
a system module.  The object code size (still without realloc
implemented) is about half that of the present malloc module at
around 1500 bytes  More like 2k when inlined.  Realloc is going to
be able to avoid much copying.

-- 
Chuck F (cbfalconer AT yahoo DOT com) (cbfalconer AT XXXXworldnet DOT att DOT net)
   Available for consulting/temporary embedded and systems.
   (Remove "XXXX" from reply address. yahoo works unmodified)
   mailto:uce AT ftc DOT gov  (for spambots to harvest)

- Raw text -


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