Unix |
Unix v6 |
|
![]() |
alloc(3) |
![]() |
alloc, free core allocator
char *alloc(size)
free(ptr)
char *ptr;
and provide a simple general-purpose core management
package. 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 is a pointer to an
area previously allocated by this space is made available
for further allocation. Needless to say, grave disorder will
result if the space assigned by is overrun or if some random
number is handed to The routine uses a first-fit algorithm
which coalesces blocks being freed with other blocks already
free. It calls (see 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.
![]() |
alloc(3) | ![]() |