Fast Allocation and Deallocation with an Improved Buddy System

  • Authors:
  • Erik D. Demaine;J. Ian Munro

  • Affiliations:
  • -;-

  • Venue:
  • Proceedings of the 19th Conference on Foundations of Software Technology and Theoretical Computer Science
  • Year:
  • 1999

Quantified Score

Hi-index 0.00

Visualization

Abstract

We propose several modifications to the binary buddy system for managing dynamic allocation of memory blocks whose sizes are powers of two. The standard buddy system allocates and deallocates blocks in Θ(lg n) time in the worst case (and on an amortized basis), where n is the size of the memory. We present two schemes that improve the running time to O(1) time, where the time bound for deallocation is amortized. The first scheme uses one word of extra storage compared to the standard buddy system, but may fragment memory more than necessary. The second scheme has essentially the same fragmentation as the standard buddy system, and uses O(2(1+√lgn)lg lg n) bits of auxiliary storage, which is ω(lgk n) but o(nƐ) for all k ≥ 1 and Ɛ 0. Finally, we present simulation results estimating the effect of the excess fragmentation in the first scheme.