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

后端 未结 5 1444
生来不讨喜
生来不讨喜 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 15:55

    malloc() and friends are considered part of the runtime system that comes with a compiler. So each compiler can and does use different OS calls to implement malloc.

    As others have said, on Linux the options are sbrk() and mmap().

    On Windows the options are HeapAlloc() and VirtualAlloc().

提交回复
热议问题