Mail Archives: djgpp/1997/11/07/10:34:52
Nate Eldredge wrote:
>
> IIRC, sbrk() is POSIX and has been in Unix forever.
It doesn't say POSIX in the man page here (Dec Alpha, OSF/1), but that
doesn't necessarily mean anything...
> 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.
A version of malloc/free which uses sbrk to get/release memory. I was
wondering if I could use it in parallel with the existing malloc/free
and suspecting not.
> AFAIK, yes. It gives your program N more bytes of memory, and returns a
> pointer to it.
And frees it? ISTR a comment here about it not actually freeing the memory
again.
> 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.
Oh well. It would be very useful if it did, but if it's not portable ten
I'll just have to do without...
Thanks,
Chris C
- Raw text -