www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/06/18:56:07

Date: Thu, 6 Nov 1997 15:53:38 -0800 (PST)
Message-Id: <199711062353.PAA29975@adit.ap.net>
Mime-Version: 1.0
To: Christopher Croughton <crough45 AT amc DOT de>, djgpp AT delorie DOT com
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: Memory allocation

At 07:12  11/6/1997 +0100, Christopher Croughton wrote:
>How standard is the sbrk(2) function? It's on every Unix I've seen,
>and appears to be in DJGPP as well, but it's not as far as I can tell 
>ANSI.  
IIRC, sbrk() is POSIX and has been in Unix forever. 
>How much can I rely on it being there, and is using it likely
>to mess up malloc etc.? 
You should be able to find it in every Unix, and many DOS compilers also.
DJGPP obviously has it, and I think Turbo C has some cheap imitation as
well. Using it directly is quite likely to screw up malloc(), which usually
depends on being the only thing manipulating the break-point.  Also, I'm not
sure why you'd need to use it directly; malloc() can give most of the same
functionality and is almost totally portable.
> Does it actually work under DJGPP as it does
>in Unix?
AFAIK, yes. It gives your program N more bytes of memory, and returns a
pointer to it.
>
>How about the mmap(2) function?  That sounds really useful if it works...
I think mmap() is only available on fairly recent Unix implementations.
DJGPP definitely doesn't have it, and I'd be surprised if any other DOS
compiler package did.

Nate Eldredge
eldredge AT ap DOT net



- Raw text -


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