Mail Archives: djgpp-workers/2003/05/03/03:44:29
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 -