Download presentation
Presentation is loading. Please wait.
1
Memory Allocation Costs in Large C and C++ Programs n An article by David Detlefs, Al Dosser and Benjamin Zorn n Presented by Vered Ojalvo
2
Agenda n Introduction n Programs Used in the Tests n Allocators Used in the Tests n Overview of a Memory Allocator n Test Results n Summary
3
Introduction n Dynamic Storage Allocation Efficiency Importance n Many Algorithms for DSA Exist n Comparison Between Allocators is Needed n How to Compare Allocators?
4
Programs n Drawn from Wide Variety of Application Areas n Most are Publicly Available n Used in Previous DSA Comparisons
5
Programs (cont.)
7
Allocation Information by Programs
8
Allocators n Several Allocators Tested n Most are Public, One Commercially Available n Each Implements a Different Allocation Algorithm
9
Allocators - List of
10
Allocators - List of (cont.)
11
A Memory Allocator n Introduction n Goals n Algorithm n Implementation Considerations
12
Memory Allocator - Introduction n Written by Doug Lea n Publicly Available n Widely Used in Linux, embedded systems and PC environments
13
Memory Allocator - Goals Balance Between a Number of Goals: n Maximizing Compatibility n Maximizing Portability n Minimizing Space
14
Memory Allocator - Goals (cont.) n Minimizing Time n Maximizing Locality n Maximizing Error Detection
15
Memory Allocator - Goal Discussion Some say (Paul Wilson and others in “Dynamic Storage Allocation: A Survey and Critical Review”) that the allocator’s primary goal is minimizing space by minimizing wastage.
16
Memory Allocator - Goal Discussion (cont.) Doug Lea believes that while time/space issues dominate, the set of tradeoffs and compromises is nearly endless.
17
Memory Allocator - Goal Discussion (cont.) For Example: n Worst-case alignment increases wastage by forcing skips of bytes to align chunks n Some methods that improve time/space for small programs may cause unacceptably worse time/space characteristics in large programs
18
Memory Allocator - Algorithms Two core elements: n Boundary Tags - Size Information Before and After the Chunk n Binning - Available Chunks are Maintained in Bins, and Grouped by Size
19
Boundary Tags
20
Binning
21
Data Gathering Methods n Instruction Counts Using Larus QPT’ tool Provides Per-Procedure Counts n Execution time Measured Using the c-shell time Command n Program Live Data Using a Modified malloc / free
22
Tests Results n How Many Instructions (Absolute and Relative) for Every malloc / free Operation n Using All Combinations of Programs and Allocators
23
Test Results
25
n Number of Instructions per Object Allocated (absolute and relative) n Number of Instructions in malloc, free and realloc (and all related routines), by Total Number of Instructions
26
Test Results
28
Summary The Paper Presents Detailed Measurements of the Costs of Dynamic Storage Allocation in 11 Diverse C and C++ Programs Using 5 Different DSA Implementations
29
Thank You
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.