1 / 29

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. Introduction Programs Used in the Tests Allocators Used in the Tests Overview of a Memory Allocator Test Results Summary. Introduction.

lauren
Télécharger la présentation

Memory Allocation Costs in Large C and C++ Programs

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Memory Allocation Costs in Large C and C++ Programs • An article by David Detlefs, Al Dosser and Benjamin Zorn • Presented by Vered Ojalvo

  2. Agenda • Introduction • Programs Used in the Tests • Allocators Used in the Tests • Overview of a Memory Allocator • Test Results • Summary

  3. Introduction • Dynamic Storage Allocation Efficiency Importance • Many Algorithms for DSA Exist • Comparison Between Allocators is Needed • How to Compare Allocators?

  4. Programs • Drawn from Wide Variety of Application Areas • Most are Publicly Available • Used in Previous DSA Comparisons

  5. Programs (cont.)

  6. Programs (cont.)

  7. Allocation Information by Programs

  8. Allocators • Several Allocators Tested • Most are Public, One Commercially Available • Each Implements a Different Allocation Algorithm

  9. Allocators - List of

  10. Allocators - List of (cont.)

  11. A Memory Allocator • Introduction • Goals • Algorithm • Implementation Considerations

  12. Memory Allocator - Introduction • Written by Doug Lea • Publicly Available • Widely Used in Linux, embedded systems and PC environments

  13. Memory Allocator -Goals Balance Between a Number of Goals: • Maximizing Compatibility • Maximizing Portability • Minimizing Space

  14. Memory Allocator -Goals (cont.) • Minimizing Time • Maximizing Locality • 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: • 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

  18. 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

  19. Boundary Tags

  20. Binning

  21. 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

  22. Tests Results • How Many Instructions (Absolute and Relative) for Every malloc / free Operation • Using All Combinations of Programs and Allocators

  23. Test Results

  24. Test Results

  25. 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

  26. Test Results

  27. 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

More Related