[comp.lang.c] brk

unicorn@uxh.cso.uiuc.edu (Harry E Miller) (06/18/91)

Can someone explain to me what the functions brk and sbrk do, and
some possible uses of them.

Thanks in advance!

Harry E. Miller - "The Nine-Fingered Bandit"
unicorn@uxh.cso.uiuc.edu

ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) (06/19/91)

In article <1991Jun18.142419.24545@ux1.cso.uiuc.edu>, unicorn@uxh.cso.uiuc.edu (Harry E Miller) writes:
> Can someone explain to me what the functions brk and sbrk do, and
> some possible uses of them.

If you need an explanation, then they aren't in your manual, and that
means you probably haven't got access to them.  [Hint: they were UNIX
specific.  Hint: some of the non-UNIX systems that appear to have 'em
do strange things with them.  Hint: they aren't in POSIX.]

They were very useful on PDP-11s.  But now?  Forget it.  Use malloc()
and free().  There was an article in the C Users Journal about them,
but it wasn't a good article.  Stick with malloc() and free().

-- 
Q:  What should I know about quicksort?   A:  That it is *slow*.
Q:  When should I use it?  A:  When you have only 256 words of main storage.