Mail Archives: djgpp-workers/2002/05/16/19:04:38.1
Charles Sandmann wrote:
>
> > > It cannot be told to supply a negative increment, thus reducing
> > > the portion supplied (question, not statement)?
> >
> > The DJGPP implementation of sbrk does accept a negative argument, but
> > it doesn't return that memory to the system.
>
> Correct, it just internally changes the pointer but knows internally
> that it's still there and available.
>
> When you have multiple memory zones, which may not be contiguous,
> if you pass a negative argument which spans those zones really bad
> things happen. So negative arguments only work for the unixy sbrk,
> or standard sbrk for increments which don't step over a block
> boundary.
>
> It might be possible to make sbrk() return these blocks to DPMI, but
> I have no plans to revisit that ugly assembler code unless something's
> badly broken.
It should be totally unnecessary, because the malloc code is the
only access to sbrk provided in the whole system (barring emacs).
However I see no sbrk documentation as to what is valid/invalid
etc.
--
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 -