Protolibc is a small C standard library based on neatlibc
This libc was patched so you'll be able to compile it using tinycc
and any other compiler
- BSD functions like
setprogname,getprogname,strlcpyandstrlcat - OpenBSD-like
pledge - custom 2 assert functions
assert2andenv_assert __PROTOGEN__macro indicating you are linking against protolibc- custom malloc implementation
protomalloc
Custom implementation of malloc
set of functions:
malloc- your standard malloccalloc- your standard callocrealloc- your standard reallocfree- your standard freefastmalloc- fast version of the function malloc, doesn't search for freed blocksfastcalloc- same as fastmallocfastrealloc- a little slower realloc but does a lot less operationsreallocarray- safe array reallocationsrecallocarray- same as reallocarray but it zeroes out new datafreezero- discards data on the pointer and freesmalloc_usable_size- optain size of block of allocated memory
set either through:
- env
MALLOC_OPTIONS - variable
const char *malloc_options- defined instdlib.h - config file
/etc/malloc.conf
set of options:
- C - "Canaries", add canaries at the end of allocations in order to detect heap overflows. The canary's content is checked when free is called. If it has been corrupted, the process is aborted.
- D - "Dump", malloc() will dump a leak report at exit. To view the leak report use protolibc memdump viewer. This option can be followed by + to also dump memory content
- F - "Freecheck", if invalid pointer is found, instead of abort(), errno value will be set
- J - "Junking", add junk value to newly allocated memory to indicate unused space
- V - "Verbose", used for debug purposes, prints information to stderr
- X - "Xmalloc", rather than return failure, abort() the program with a diagnostic message on stderr