Table of Contents
Fetching ...

A Nearly Quadratic Improvement for Memory Reallocation

Martin Farach-Colton, William Kuszmaul, Nathan Sheffield, Alek Westover

TL;DR

The paper addresses the Memory Reallocation problem under a load factor of at most $1-\varepsilon$, seeking to minimize online reallocation cost. It introduces new allocators that beat the folklore $O(\varepsilon^{-1})$ bound for arbitrary item sizes, achieving $O(\varepsilon^{-1/2}\operatorname{polylog} \varepsilon^{-1})$ in expectation, and proves a non-trivial lower bound of $\Omega(\log \varepsilon^{-1})$ on update cost for certain input sequences. It also analyzes a stochastic setting with random item sizes, obtaining $O(\log \varepsilon^{-1})$ expected updates, and develops a suite of techniques (SIMPLE, GEO, FLEXHASH, TINYHASH, and RSUM) including nested responsibility suffixes and geometric size classes to organize memory efficiently. Overall, the results substantially improve prior bounds and illuminate a potential structure-randomness trade-off in memory reallocation problems, with practical implications for dynamic storage allocators.

Abstract

In the Memory Reallocation Problem a set of items of various sizes must be dynamically assigned to non-overlapping contiguous chunks of memory. It is guaranteed that the sum of the sizes of all items present at any time is at most a $(1-\varepsilon)$-fraction of the total size of memory (i.e., the load-factor is at most $1-\varepsilon$). The allocator receives insert and delete requests online, and can re-arrange existing items to handle the requests, but at a reallocation cost defined to be the sum of the sizes of items moved divided by the size of the item being inserted/deleted. The folklore algorithm for Memory Reallocation achieves a cost of $O(\varepsilon^{-1})$ per update. In recent work at FOCS'23, Kuszmaul showed that, in the special case where each item is promised to be smaller than an $\varepsilon^4$-fraction of memory, it is possible to achieve expected update cost $O(\log\varepsilon^{-1})$. Kuszmaul conjectures, however, that for larger items the folklore algorithm is optimal. In this work we disprove Kuszmaul's conjecture, giving an allocator that achieves expected update cost $O(\varepsilon^{-1/2} \operatorname*{polylog} \varepsilon^{-1})$ on any input sequence. We also give the first non-trivial lower bound for the Memory Reallocation Problem: we demonstrate an input sequence on which any resizable allocator (even offline) must incur amortized update cost at least $Ω(\log\varepsilon^{-1})$. Finally, we analyze the Memory Reallocation Problem on a stochastic sequence of inserts and deletes, with random sizes in $[δ, 2 δ]$ for some $δ$. We show that, in this simplified setting, it is possible to achieve $O(\log\varepsilon^{-1})$ expected update cost, even in the ``large item'' parameter regime ($δ> \varepsilon^4$).

A Nearly Quadratic Improvement for Memory Reallocation

TL;DR

The paper addresses the Memory Reallocation problem under a load factor of at most , seeking to minimize online reallocation cost. It introduces new allocators that beat the folklore bound for arbitrary item sizes, achieving in expectation, and proves a non-trivial lower bound of on update cost for certain input sequences. It also analyzes a stochastic setting with random item sizes, obtaining expected updates, and develops a suite of techniques (SIMPLE, GEO, FLEXHASH, TINYHASH, and RSUM) including nested responsibility suffixes and geometric size classes to organize memory efficiently. Overall, the results substantially improve prior bounds and illuminate a potential structure-randomness trade-off in memory reallocation problems, with practical implications for dynamic storage allocators.

Abstract

In the Memory Reallocation Problem a set of items of various sizes must be dynamically assigned to non-overlapping contiguous chunks of memory. It is guaranteed that the sum of the sizes of all items present at any time is at most a -fraction of the total size of memory (i.e., the load-factor is at most ). The allocator receives insert and delete requests online, and can re-arrange existing items to handle the requests, but at a reallocation cost defined to be the sum of the sizes of items moved divided by the size of the item being inserted/deleted. The folklore algorithm for Memory Reallocation achieves a cost of per update. In recent work at FOCS'23, Kuszmaul showed that, in the special case where each item is promised to be smaller than an -fraction of memory, it is possible to achieve expected update cost . Kuszmaul conjectures, however, that for larger items the folklore algorithm is optimal. In this work we disprove Kuszmaul's conjecture, giving an allocator that achieves expected update cost on any input sequence. We also give the first non-trivial lower bound for the Memory Reallocation Problem: we demonstrate an input sequence on which any resizable allocator (even offline) must incur amortized update cost at least . Finally, we analyze the Memory Reallocation Problem on a stochastic sequence of inserts and deletes, with random sizes in for some . We show that, in this simplified setting, it is possible to achieve expected update cost, even in the ``large item'' parameter regime ().
Paper Structure (12 sections, 10 theorems, 3 equations, 1 figure)

This paper contains 12 sections, 10 theorems, 3 equations, 1 figure.

Key Result

theorem 1

There is a resizable allocator for items of with sizes in $[\varepsilon,2\varepsilon)$ that achieves amortized update cost $O(\varepsilon^{-2/3})$.

Figures (1)

  • Figure 3: Because TINYHASH decomposes into interchangeable memory-units, we can make TINYHASH relocatable by rotating memory-units to handle external updates.

Theorems & Definitions (10)

  • theorem 1
  • theorem 2
  • corollary 1
  • lemma 9
  • corollary 2
  • theorem 3
  • theorem 4
  • theorem 5
  • lemma 15
  • lemma 15