Memory allocation costs in large c and c programs
Download
1 / 29

Memory Allocation Costs in Large C and C++ Programs - PowerPoint PPT Presentation


  • 56 Views
  • Uploaded on

Memory Allocation Costs in Large C and C++ Programs. An article by David Detlefs, Al Dosser and Benjamin Zorn Presented by Vered Ojalvo. Agenda. Introduction Programs Used in the Tests Allocators Used in the Tests Overview of a Memory Allocator Test Results Summary. Introduction.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Memory Allocation Costs in Large C and C++ Programs' - lauren


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Memory allocation costs in large c and c programs
Memory Allocation Costs in Large C and C++ Programs

  • An article by David Detlefs, Al Dosser and Benjamin Zorn

  • Presented by Vered Ojalvo


Agenda
Agenda

  • Introduction

  • Programs Used in the Tests

  • Allocators Used in the Tests

  • Overview of a Memory Allocator

  • Test Results

  • Summary


Introduction
Introduction

  • Dynamic Storage Allocation Efficiency Importance

  • Many Algorithms for DSA Exist

  • Comparison Between Allocators is Needed

  • How to Compare Allocators?


Programs
Programs

  • Drawn from Wide Variety of Application Areas

  • Most are Publicly Available

  • Used in Previous DSA Comparisons





Allocators
Allocators

  • Several Allocators Tested

  • Most are Public, One Commercially Available

  • Each Implements a Different Allocation Algorithm




A memory allocator
A Memory Allocator

  • Introduction

  • Goals

  • Algorithm

  • Implementation Considerations


Memory allocator introduction
Memory Allocator - Introduction

  • Written by Doug Lea

  • Publicly Available

  • Widely Used in Linux, embedded systems and PC environments


Memory allocator goals
Memory Allocator -Goals

Balance Between a Number of Goals:

  • Maximizing Compatibility

  • Maximizing Portability

  • Minimizing Space


Memory allocator goals cont
Memory Allocator -Goals (cont.)

  • Minimizing Time

  • Maximizing Locality

  • Maximizing Error Detection


Memory allocator goal discussion
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.


Memory allocator goal discussion cont
Memory Allocator - Goal Discussion (cont.)

Doug Lea believes that while time/space issues dominate, the set of tradeoffs and compromises is nearly endless.


Memory allocator goal discussion cont1
Memory Allocator - Goal Discussion (cont.)

For Example:

  • Worst-case alignment increases wastage by forcing skips of bytes to align chunks

  • Some methods that improve time/space for small programs may cause unacceptably worse time/space characteristics in large programs


Memory allocator algorithms
Memory Allocator - Algorithms

Two core elements:

  • Boundary Tags - Size Information Before and After the Chunk

  • Binning - Available Chunks are Maintained in Bins, and Grouped by Size




Data gathering methods
Data Gathering Methods

  • Instruction Counts Using Larus QPT’ tool Provides Per-Procedure Counts

  • Execution time Measured Using the c-shell time Command

  • Program Live Data Using a Modified malloc / free


Tests results
Tests Results

  • How Many Instructions (Absolute and Relative) for Every malloc / free Operation

  • Using All Combinations of Programs and Allocators




Test results2
Test Results

  • Number of Instructions per Object Allocated (absolute and relative)

  • Number of Instructions in malloc, free and realloc (and all related routines), by Total Number of Instructions




Summary
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



ad