I recently saw the following post:
A memory allocator isn\'t lower level than malloc. (The default allocator typically calls malloc directly or indi
My question is- how is malloc implemented in the following Operating systems?
On Linux there are two famous malloc
implementations:
dlmalloc (Doug Lea's malloc)
ptmalloc
On Linux libc like glibc, eglibc or newlib implement ptmalloc or a variant of ptmalloc.
what are the OS-specific functions which are called/implementations of malloc()?
On Unix and Linux systems sbrk
and mmap
system calls are used. See man 2 sbrk
and man 2 mmap
for more information.