X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-workers-bounces using -f Message-ID: <3CE41EB8.619484D9@yahoo.com> Date: Thu, 16 May 2002 17:03:52 -0400 From: CBFalconer 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: <10205161914 DOT AA17309 AT clio DOT rice DOT edu> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com 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. USE worldnet address!