Date: Sun, 9 Nov 1997 12:36:14 +0200 (IST) From: Eli Zaretskii To: Christopher Croughton cc: djgpp AT delorie DOT com Subject: Re: Memory allocation In-Reply-To: <97Nov6.200722gmt+0100.11649@internet01.amc.de> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Thu, 6 Nov 1997, 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. It's neither ANSI nor POSIX. (You can tell that by looking at the DJGPP header that declares it: the prototype is AFTER the #ifndef _POSIX_SOURCE directive.) But I have yet to see a C library that doesn't have `sbrk'. I think you can pretty much count on it. > Does it actually work under DJGPP as it does in Unix? Yes, but note these two gotchas: 1) It doesn't return memory to the DPMI host when called with a negative argument; 2) It doesn't zero out the memory it gets from the DPMI host (unless you use the _CRT0_FLAG_FILL_SBRK_MEMORY flag). > How about the mmap(2) function? That sounds really useful if it works... AFAIK, `mmap' isn't possible with DPMI 0.9, because it doesn't support page-level protection. Only DPMI 1.0 can do that.