delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2002/05/16/15:13:03

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-workers-bounces using -f
From: sandmann AT clio DOT rice DOT edu (Charles Sandmann)
Message-Id: <10205161914.AA17309@clio.rice.edu>
Subject: Re: Malloc/free DJGPP code
To: djgpp-workers AT delorie DOT com
Date: Thu, 16 May 2002 14:14:16 -0500 (CDT)
In-Reply-To: <4839-Thu16May2002215006+0300-eliz@is.elta.co.il> from "Eli Zaretskii" at May 16, 2002 09:50:07 PM
X-Mailer: ELM [version 2.5 PL2]
Mime-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

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

- Raw text -


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