What are the Windows and Linux native OS/system calls made from malloc()?

后端 未结 5 1408
生来不讨喜
生来不讨喜 2020-12-31 15:19

I recently saw the following post:

A memory allocator isn\'t lower level than malloc. (The default allocator typically calls malloc directly or indi

5条回答
  •  离开以前
    2020-12-31 16:08

    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.

提交回复
热议问题