delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2002/02/19/20:10:48

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-workers-bounces using -f
Message-ID: <3C72ED37.A7BD29CC@yahoo.com>
Date: Tue, 19 Feb 2002 19:26:31 -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: <10202192346 DOT AA14305 AT clio DOT rice DOT edu>
Reply-To: djgpp-workers AT delorie DOT com

Charles Sandmann wrote:
> 
... snip ...
> 
> If there was some way to do a binary search in a sorted list we could
> make that a log(n) type behavior which would IMO be acceptable, but
> O(n) is bad.
> 
> > I can easily make a portion of the revised memblock compatible
> > with the original, in that the size and freelist pointer will be
> > at the same (-ve) offsets from the user pointer.  That would
> > forbid the safety improvement I am making to guard against
> > off-by-one indexed operations.  Publishing the offsets of those
> > two items in implementation space would allow gradual conversion
> > of unclean software that uses them, so that eventually the module
> > would be truly independant  If the other software uses only the
> > size that is better.  I envision a globally available variable:
> >
> >    const int __msize_offset = offsetof(memblock, data)
> >                             - offsetof(memblock, size);
> >
> > and the header contains:
> >
> >    extern const int __msize_offset;
> >
> > which is initially constrained (and documented) to be the same as
> > the present.
> 
> Be aware that alignment is also a very important issue here that we
> just discussed about a week ago - I don't think we've decided which
> of the 2 ways we should pick yet to fix our occasional alignment
> offset issue.  I'm pretty uncomfortable making any major changes to
> malloc() for many reasons if it can be avoided.

If sbrk alignment is controlled malloc alignment is controlled.
Pick a size.

-- 
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