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



NAME
     alloc, free - core allocator

SYNOPSIS
     char *alloc(size)

     free(ptr)
     char *ptr;

DESCRIPTION
     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.

DIAGNOSTICS
     Returns -1 if there is no available core.

BUGS
     Allocated  memory contains garbage instead of being cleared.


























                              - 1 -