Is there any benefit to use multiple heaps for memory management purposes?

前端 未结 5 2052
-上瘾入骨i
-上瘾入骨i 2021-02-15 17:37

I am a student of a system software faculty. Now I\'m developing a memory manager for Windows. Here\'s my simple implementation of malloc() and free():

5条回答
  •  执笔经年
    2021-02-15 17:55

    The only time I ever used more than one heap was when I wrote a program that would build a complicated data structure. It would have been non-trivial to free the data structure by walking through it and freeing the individual nodes, but luckily for me the program only needed the data structure temporarily (while it performed a particular operation), so I used a separate heap for the data structure so that when I no longer needed it, I could free it with one call to HeapDestroy.

提交回复
热议问题