伙伴算法

伙伴算法是一种将内存对半分割来尽量实现最佳匹配的内存分配算法，由哈里·马科维茨于1963年发明。Kenneth C. Knowlton. A Fast storage allocator. Communications of the ACM 8(10):623–625, Oct 1965. also Kenneth C Knowlton. A programmer's description of L6. Communications of the ACM, 9(8):616–625, Aug. 1966 [see also : Google books  page 85]

 示例 
在以下示例系统中，最小的内存块大小为64千字节，内存块大小的最大值为4，因此最大的可分配内存块大小为。下面展示了系统在经历多次内存请求后的可能状态。
步骤64 K64 K64 K64 K64 K64 K64 K64 K64 K64 K64 K64 K64 K64 K64 K64 K1242.123232.22222232.3212122232.420202122232.5A: 20202122233A: 2020B: 2122234A: 20C: 20B: 2122235.1A: 20C: 20B: 212121235.2A: 20C: 20B: 21D: 2121236A: 20C: 2021D: 2121237.1A: 20C: 20212121237.2A: 20C: 20212223820C: 202122239.120202122239.2212122239.32222239.423239.524

 参考文献 

Category:内存管理算法