delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2003/05/03/03:44:29

Message-ID: <3EB372C3.451554C9@yahoo.com>
Date: Sat, 03 May 2003 03:41:55 -0400
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 documentation revisions
References: <3EAF5020 DOT 9E3C6C9A AT yahoo DOT com> <7458-Wed30Apr2003210444+0300-eliz AT elta DOT co DOT il> <3EB08219 DOT 3D55D32A AT yahoo DOT com> <3EB1555C DOT D52AC0B6 AT yahoo DOT com> <3EB2B5C0 DOT 987AC700 AT yahoo DOT com> <2110-Sat03May2003004811+0300-eliz AT elta DOT co DOT il> <3EB2F494 DOT 5CDF344B AT yahoo DOT com>
Reply-To: djgpp-workers AT delorie DOT com

CBFalconer wrote:
> Eli Zaretskii wrote:
> > > Date: Fri, 02 May 2003 14:15:28 -0400
> > > From: CBFalconer <cbfalconer AT yahoo DOT com>
> > >
> > > On looking things over, I think that the test for oversize
> > > allocations should also be done for realloc, and that the
> > > malloc_fail hook should also be called for realloc_failure.  The
> > > hook can tell the difference by the non-NULLness of ptr.
> >
> > In the old malloc, realloc always called malloc whenever the
> > allocation was about to grow, and so these tests were not required in
> > realloc as malloc would do that anyway.  If your code can grow an
> > allocation without calling malloc in the process, malloc_fail hook
> > should indeed be called in realloc, and likewise for the
> > preposterously large allocations.
> 
> Ok, a minor revision.  I reject allocation requests for anything
> over (INT_MAX-65536).  Yes, realloc grows without calling malloc.
> It goes to lengths to avoid moving any data, which seems to work
> about half the time or more.  Failing that it attempts to expand
> to free space adjacent below.  The only case where realloc calls
> malloc is realloc(NULL, size).  So realloc should be quite
> efficient in the wild.

Revisions done.  Added documentation note about rejecting over
size allocations and level 3 signals realloc or malloc failures. 
Results on:

  <http://cbfalconer.home.att.net/download/nmalloc.zip>

with a 2003-05-03 date.  Now can I relax?

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