为什么自由列表没有排序?

时间:2017-06-29 22:57:44

标签: c data-structures malloc free

我研究malloc,sbrk和免费列表管理。现在我想知道为什么自由列表没有以某种方式排序,它似乎可以从搜索树而不是普通的链表中受益。它在我正在阅读的book中看起来的方式只是一个包含任意大小的免费内存块的列表。如果我们保持列表排序,那么第一次拟合也是最合适的,这似乎是微不足道的。

我确定之前已经考虑过了,但为什么不这样做呢?

1 个答案:

答案 0 :(得分:1)

该部分介绍的大多数算法主要是为了减少碎片和搜索成本。根据"其他想法"在提出第一次合身,最佳合身,最差合身等时,他提到了他的推理......

One major problem with many of the approaches described above is their
lack of scaling. Specifically, searching lists can be quite slow. Thus,
advanced allocators use more complex data structures to address these
costs, trading simplicity for performance. Examples include balanced binary
trees, splay trees, or partially-ordered trees [W+95].

http://pages.cs.wisc.edu/~remzi/OSTEP/vm-freespace.pdf