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: <10205170333.AA15841@clio.rice.edu> Subject: Re: Malloc/free DJGPP code To: djgpp-workers AT delorie DOT com Date: Thu, 16 May 2002 22:33:38 -0500 (CDT) In-Reply-To: <3CE41EB8.619484D9@yahoo.com> from "CBFalconer" at May 16, 2002 05:03:52 PM X-Mailer: ELM [version 2.5 PL2] Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 Precedence: bulk > It should be totally unnecessary, because the malloc code is the > only access to sbrk provided in the whole system (barring emacs). sbrk() is a fairly standard unix API used to control memory. Many programs use it when they want control over memory with lower overhead than malloc(). Almost no unix applications call it with a negative argument, since any library routine which did a malloc (or sbrk) could still be expecting memory beyond what you just contracted with a negative argument. However, if you use the unixy sbrk() flag, I believe you should get unix API compatible behavior, even with negative increments. > However I see no sbrk documentation as to what is valid/invalid etc. Documentation can frequently be improved as far as small details. But in this case it pretty much does what you ask it to, per the info pages. It's a low level routine, with no safety. And the DJGPP documentation is more clear and precise on what it does than either of the two commercial unix man pages I just checked ...