How are malloc and free implemented?

后端 未结 6 1001
心在旅途
心在旅途 2020-12-16 00:42

I want to implement my own dynamic memory management system in order to add new features that help to manage memory in C++.

I use Windows (XP) and Linux (Ubuntu). Wh

6条回答
  •  感情败类
    2020-12-16 01:22

    On linux, malloc and free are not system calls. malloc/free obtains memory from the kernel by extending and shrinking(if it can) the data segment using the brk system calls as well as obtaining anonymous memory with mmap - and malloc manages memory within those regions. Some basic information any many great references can be found here

提交回复
热议问题