How are malloc and free implemented?

后端 未结 6 1005
心在旅途
心在旅途 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:04

    If you are simply wrapping the system calls then you are probably not gaining anything on using the standard malloc - thats all they are doing.

    It's more common to malloc (or HeapAlloc() etc ) a single block of memory at the start of the program and manage the allocation into this yourself, this can be more efficient if you know you are going to be creating/discarding a lot of small blocks of memory regularly.

提交回复
热议问题