mbkalloc(3)
mbk memory allocator
SYNOPSYS
#include "mut.h"
char *mbkalloc(bytes)
unsigned int bytes;
PARAMETER
- bytes
-
Number of memory bytes to be contiguously allocated
DESCRIPTION
mbkalloc returns a block of
bytes length, for any purpose.
It is now a day just an encapsulation of the system
malloc function,
but may evolve to a special allocator in the future. Its use is strongly
encouraged.
- Remark :
-
a global variable, long mbkalloc_stat, updates the number of allocated
bytes, and may be accessed by anyone to see the amount of allocated memory.
RETURN VALUE
mbkalloc returns a pointer to a bytes long block.
ERROR
"*** mbk error *** mbkalloc impossible : not enough memory"
-
System break can't be moved anymore, no more memory can be retrieved from
the system.
EXAMPLE
#include "mut.h"
char *dup_str(s);
{
char *t = (char *)mbkalloc(strlen(s) + (unsigned int)1);
strcpy(t, s);
return t;
}