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

后端 未结 5 1446
生来不讨喜
生来不讨喜 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:57

    On Windows, malloc implementations will usally call the win32 heap functions like HeapCreate, HeapDestroy, HeapAlloc, HeapFree. Those functions will call the NTDLL usermode heap manager located within ntdll.dll, those functions will have the RtlxxxHeap name, RtlAllocateHeap, RtlCreateHeap, etc...

    In the end system calls within the NtxxxVirtualMemory group will be called, NtAllocateVirtualMemory, NtQueryVirtualMemory, NtFreeVirtualMemory.

提交回复
热议问题