Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
article

Reconsidering custom memory allocation

Published: 04 November 2002 Publication History

Abstract

Programmers hoping to achieve performance improvements often use custom memory allocators. This in-depth study examines eight applications that use custom allocators. Surprisingly, for six of these applications, a state-of-the-art general-purpose allocator (the Lea allocator) performs as well as or better than the custom allocators. The two exceptions use regions, which deliver higher performance (improvements of up to 44%). Regions also reduce programmer burden and eliminate a source of memory leaks. However, we show that the inability of programmers to free individual objects within regions can lead to a substantial increase in memory consumption. Worse, this limitation precludes the use of regions for common programming idioms, reducing their usefulness.We present a generalization of general-purpose and region-based allocators that we call reaps. Reaps are a combination of regions and heaps, providing a full range of region semantics with the addition of individual object deletion. We show that our implementation of reaps provides high performance, outperforming other allocators with region-like semantics. We then use a case study to demonstrate the space advantages and software engineering benefits of reaps in practice. Our results indicate that programmers needing fast regions should use reaps, and that most programmers considering custom allocators should instead use the Lea allocator.

References

[1]
Apache Foundation. Apache Web server. http://www.apache.org.
[2]
William S. Beebee and Martin C. Rinard. An implementation of scoped memory for Real-Time Java. In EMSOFT, pages 289--305, 2001.
[3]
Emery D. Berger, Kathryn S. McKinley, Robert D. Blumofe, and Paul R. Wilson. Hoard: A scalable memory allocator for multithreaded applications. In International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS-IX), pages 117--128, Cambridge, MA, November 2000.
[4]
Emery D. Berger, Benjamin G. Zorn, and Kathryn S. McKinley. Composing high-performance memory allocators. In Proceedings of the 2001 ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI), pages 114--124, Snowbird, Utah, June 2001.
[5]
Greg Bollella, James Gosling, Benjamin Brosgol, Peter Dibble, Steve Furr, and Mark Turnbull. The Real-Time Specification for Java. Addison-Wesley, 2000.
[6]
Gilad Bracha and William Cook. Mixin-based inheritance. In Norman Meyrowitz, editor, Proceedings of the Conference on Object-Oriented Programming: Systems, Languages, and Applications (OOPSLA) / Proceedings of the European Conference on Object-Oriented Programming (ECOOP), pages 303--311, Ottawa, Canada, 1990. ACM Press.
[7]
Dov Bulka and David Mayhew. Efficient C++. Addison-Wesley, 2001.
[8]
Trishul Chilimbi. Efficient representations and abstractions for quantifying and exploiting data reference locality. In Proceedings of the 2001 ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI), pages 191--202, Snowbird, Utah, June 2001.
[9]
Trishul M. Chilimbi, Mark D. Hill, and James R. Larus. Cache-conscious structure layout. In Proceedings of the 1999 ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI), pages 1--12, Atlanta, GA, May 1999.
[10]
Margaret A. Ellis and Bjarne Stroustrop. The Annotated C++ Reference Manual. Addison-Wesley, 1990.
[11]
Boris Fomitchev. STLport. http://www.stlport.org/.
[12]
Christopher W. Fraser and David R. Hanson. A Retargetable C Compiler: Design and Implementation. Addison-Wesley, 1995.
[13]
Free Software Foundation. GCC Home Page. http://gcc.gnu.org/.
[14]
David Gay and Alex Aiken. Memory management with explicit regions. In Proceedings of the 1998 ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI), pages 313--323, Montreal, Canada, June 1998.
[15]
David Gay and Alex Aiken. Language support for regions. In Proceedings of the 2001 ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI), pages 70--80, Snowbird, Utah, June 2001.
[16]
Wolfram Gloger. Dynamic memory allocator implementations in Linux system libraries. http://www.dent.med.uni-muenchen.de/~wmglo/malloc-slides.html.
[17]
Dan Grossman, Greg Morrisett, Trevor Jim, Michael Hicks, Yanling Wang, and James Cheney. Region-based memory management in cyclone. In Proceedings of the 2002 ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI), pages 282--293, Berlin, Germany, June 2002.
[18]
Sam Guyer, Daniel A. Jiménez, and Calvin Lin. The C-Breeze compiler infrastructure. Technical Report UTCS-TR01-43, The University of Texas at Austin, November 2001.
[19]
David R. Hanson. Fast allocation and deallocation of memory based on object lifetimes. In Software Practice & Experience, number 20(1), pages 5--12. Wiley, January 1990.
[20]
David R. Hanson. C Interfaces and Implementation. Addison-Wesley, 1997.
[21]
Reed Hastings and Bob Joyce. Purify: Fast detection of memory leaks and access errors. In Proceedings of the Winter USENIX 1992 Conference, pages 125--136, December 1992.
[22]
Mark S. Johnstone and Paul R. Wilson. The memory fragmentation problem: Solved? In International Symposium on Memory Management, pages 26--36, Vancouver, B.C., Canada, 1998.
[23]
Doug Lea. A memory allocator. http://g.oswego.edu/dl/html/malloc.html.
[24]
Scott Meyers. Effective C++. Addison-Wesley, 1996.
[25]
Scott Meyers. More Effective C++. Addison-Wesley, 1997.
[26]
Bartosz Milewski. C++ In Action: Industrial-Strength Programming Techniques. Addison-Wesley, 2001.
[27]
Philip A. Nelson. bc - An arbitrary precision calculator language. http://www.gnu.org/software/bc/bc.html.
[28]
Jeffrey Richter. Advanced Windows: the developer's guide to the Win32 API for Windows NT 3.5 and Windows 95. Microsoft Press.
[29]
Gustavo Rodriguez-Rivera, Mike Spertus, and Charles Fiterman. Conservative garbage collection for general memory allocators. In International Symposium on Memory Management, Minneapolis, Minnesota, 2000.
[30]
D. T. Ross. The AED free storage package. Communications of the ACM, 10(8):481--492, 1967.
[31]
Colin Runciman and Niklas Rojemo. Lag, drag and postmortem heap profiling. In Implementation of Functional Languages Workshop, Bastad, Sweden, September 1995.
[32]
SGI. The Standard Template Library for C++: Allocators. http://www.sgi.com/tech/stl/Allocators.html.
[33]
Ran Shaham, Elliot K. Kolodner, and Mooly Sagiv. Heap profiling for space-efficient Java. In Proceedings of the 2001 ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI), pages 104--113, Snowbird, Utah, June 2001.
[34]
Standard Performance Evaluation Corporation. SPEC2000. http://www.spec.org.
[35]
Standard Performance Evaluation Corporation. SPEC95. http://www.spec.org.
[36]
Lincoln Stein, Doug MacEachern, and Linda Mui. Writing Apache Modules with Perl and C. O'Reilly & Associates, 1999.
[37]
Bjarne Stroustrup. The C++ Programming Language, Second Edition. (Addison-Wesley), 1991.
[38]
Suzanne Pierce. PPRC: Microsoft's Tool Box. http://research.microsoft.com/research/pprc/mstoolbox.asp.
[39]
Mads Tofte and Jean-Pierre Talpin. Region-based memory management. Information and Computation, 132(2):109--176, 1997.
[40]
Dan N. Truong, François Bodin, and André Seznec. Improving cache behavior of dynamically allocated data structures. In International Conference on Parallel Architectures and Compilation Techniques, pages 322--329, October 1998.
[41]
Kiem-Phong Vo. Vmalloc: A general and efficient memory allocator. In Software Practice & Experience, number 26, pages 1--18. Wiley, 1996.
[42]
Mark Weiser, Alan Demers, and Carl Hauser. The Portable Common Runtime approach to interoperability. In Twelfth ACM Symposium on Operating Systems Principles, pages 114--122, December 1989.
[43]
P. R. Wilson, M. S. Johnstone, M. Neely, and D. Boles. Dynamic storage allocation: A survey and critical review. Lecture Notes in Computer Science, 986, 1995.
[44]
Benjamin G. Zorn. The measured cost of conservative garbage collection. Software Practice and Experience, 23(7):733--756, 1993.

Cited By

View all
  • (2023)Beyond RSS: Towards Intelligent Dynamic Memory Management (Work in Progress)Proceedings of the 20th ACM SIGPLAN International Conference on Managed Programming Languages and Runtimes10.1145/3617651.3622989(158-164)Online publication date: 19-Oct-2023
  • (2023)The Unexpected Efficiency of Bin Packing Algorithms for Dynamic Storage Allocation in the Wild: An Intellectual AbstractProceedings of the 2023 ACM SIGPLAN International Symposium on Memory Management10.1145/3591195.3595279(58-70)Online publication date: 6-Jun-2023
  • (2019)Mimalloc: Free List Sharding in ActionProgramming Languages and Systems10.1007/978-3-030-34175-6_13(244-265)Online publication date: 18-Nov-2019
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM SIGPLAN Notices
ACM SIGPLAN Notices  Volume 37, Issue 11
November 2002
385 pages
ISSN:0362-1340
EISSN:1558-1160
DOI:10.1145/583854
Issue’s Table of Contents
  • cover image ACM Conferences
    OOPSLA '02: Proceedings of the 17th ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications
    November 2002
    396 pages
    ISBN:1581134711
    DOI:10.1145/582419
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 04 November 2002
Published in SIGPLAN Volume 37, Issue 11

Check for updates

Qualifiers

  • Article

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)73
  • Downloads (Last 6 weeks)8
Reflects downloads up to 15 Oct 2024

Other Metrics

Citations

Cited By

View all
  • (2023)Beyond RSS: Towards Intelligent Dynamic Memory Management (Work in Progress)Proceedings of the 20th ACM SIGPLAN International Conference on Managed Programming Languages and Runtimes10.1145/3617651.3622989(158-164)Online publication date: 19-Oct-2023
  • (2023)The Unexpected Efficiency of Bin Packing Algorithms for Dynamic Storage Allocation in the Wild: An Intellectual AbstractProceedings of the 2023 ACM SIGPLAN International Symposium on Memory Management10.1145/3591195.3595279(58-70)Online publication date: 6-Jun-2023
  • (2019)Mimalloc: Free List Sharding in ActionProgramming Languages and Systems10.1007/978-3-030-34175-6_13(244-265)Online publication date: 18-Nov-2019
  • (2018)Deep Learning for Environmentally Robust Speech RecognitionACM Transactions on Intelligent Systems and Technology10.1145/31781159:5(1-28)Online publication date: 24-Apr-2018
  • (2018)Mining Significant Microblogs for Misinformation IdentificationACM Transactions on Intelligent Systems and Technology10.1145/31734589:5(1-20)Online publication date: 24-Apr-2018
  • (2018)Dynamic Memory Allocation of Embedded Real-Time Operating System Based on TLSFApplications and Techniques in Information Security10.1007/978-981-13-2907-4_3(29-39)Online publication date: 7-Oct-2018
  • (2017)Cache locality optimization for recursive programsACM SIGPLAN Notices10.1145/3140587.306238552:6(1-16)Online publication date: 14-Jun-2017
  • (2017)Generalizations of the theory and deployment of triangular inequality for compiler-based strength reductionACM SIGPLAN Notices10.1145/3140587.306237752:6(33-48)Online publication date: 14-Jun-2017
  • (2017)You can have it all: abstraction and good cache performanceProceedings of the 2017 ACM SIGPLAN International Symposium on New Ideas, New Paradigms, and Reflections on Programming and Software10.1145/3133850.3133861(148-167)Online publication date: 25-Oct-2017
  • (2017)ReferencesPhysically Based Rendering10.1016/B978-0-12-800645-0.50027-0(1165-1211)Online publication date: 2017
  • Show More Cited By

View Options

Get Access

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media