ALLOC(III)                    3/1/74                   ALLOC(III)

     alloc, free - core allocator

     char *alloc(size)

     char *ptr;

     Alloc and free provide a simple general-purpose core manage-
     ment package.  Alloc is given a size in bytes; it returns  a
     pointer  to  an  area  at  least that size which is even and
     hence can hold an object of any type.  The argument to  free
     is  a pointer to an area previously allocated by alloc; this
     space is made available for further allocation.

     Needless to say, grave disorder will result if the space as-
     signed by alloc is overrun or if some random number is hand-
     ed to free.

     The routine  uses  a  first-fit  algorithm  which  coalesces
     blocks being freed with other blocks already free.  It calls
     sbrk (see break(II)) to get more core from the system  when
     there is no suitable space already free.

     Returns -1 if there is no available core.

     Allocated  memory contains garbage instead of being cleared.

                              - 1 -