Copyright

by

Emery D. Berger

2002 The Dissertation Committee for Emery D. Berger

certifies that this is the approved version of the following dissertation:

Memory Management for High-Performance Applications

Committee:

Kathryn S. McKinley, Supervisor

James C. Browne

Michael D. Dahlin

Stephen W. Keckler

Benjamin G. Zorn for High-Performance Applications

by

Emery D. Berger, M.S., B.S.

Dissertation

Presented to the Faculty of the Graduate School of

The University of Texas at Austin

in Partial Fulfillment

of the Requirements

for the Degree of

Doctor of Philosophy

The University of Texas at Austin

August 2002 Memory Management for High-Performance Applications

Publication No.

Emery D. Berger, Ph.D.

The University of Texas at Austin, 2002

Supervisor: Kathryn S. McKinley

Fast and effective memory management is crucial for many applications, including web servers, database managers, and scientific codes. Unfortunately, current memory managers often do not meet these requirements. These memory managers also do not provide the support required to avoid memory leaks in server applications, and prevent multithreaded applications from scaling on multiprocessor systems. In fact, current memory managers cause some applications to slow down with the addition of more processors.

In this thesis, we address these memory management problems for high-performance applications.

We develop a memory management infrastructure called heap layers that allows us to compose efficient general-purpose memory managers from components. We show that most custom memory managers achieve slight or no performance improvements over current general-purpose memory managers. We build a hybrid memory manager called reap that combines region-based and general-purpose memory management, sim- plifying memory management for server applications. We show that previous memory managers suffer from serious problems when running on multiprocessors, including allocator-induced false sharing and a blowup in memory consumption. We present a scalable concurrent memory manager called Hoard that provably avoids these problems and significantly improves application performance.

iv Contents

Abstract iv

List of Tables ix

List of Figures xi

Chapter 1 Introduction 1

1.1 Summary of contributions ...... 3

1.2 Thesis Outline ...... 3

Chapter 2 Background and Related Work 5

2.1 Basic Concepts ...... 5

2.2 General-Purpose Memory Management ...... 6

2.3 Memory Management Infrastructures ...... 8

2.3.1 Vmalloc ...... 8

2.3.2 CMM ...... 8

2.4 Custom Memory Management ...... 9

2.4.1 Construction and Use of Custom Memory Managers ...... 9

2.4.2 Evaluation of Custom Memory Management ...... 11

Chapter 3 Experimental Methodology 12

3.1 Benchmarks ...... 12

v 3.1.1 Memory-Intensive Benchmarks ...... 12

3.1.2 General-Purpose Benchmarks ...... 13

3.2 Platforms ...... 14

3.3 Execution Environment ...... 15

Chapter 4 Composing High-Performance Memory Managers 16

4.1 Heap Layers ...... 17

4.1.1 Example: Composing a Per-Class Allocator ...... 19

4.1.2 A Library of Heap Layers ...... 21

4.2 Experimental Methodology ...... 22

4.3 Building Special-Purpose Allocators ...... 22

4.3.1 197.parser ...... 23

4.3.2 176.gcc ...... 24

4.4 Building General-Purpose Allocators ...... 26

4.4.1 The Kingsley Allocator ...... 26

4.4.2 The Lea Allocator ...... 28

4.4.3 Experimental Results ...... 30

4.5 Software Engineering Benefits ...... 31

4.6 Heap Layers as an Experimental Infrastructure ...... 32

4.7 Conclusion ...... 33

Chapter 5 Reconsidering Custom Memory Management 38

5.1 Benchmarks ...... 39

5.1.1 Emulating Regions ...... 4