Abstract: In drafting the 1998 ISO C++ language standard, the standards committee did not consider, or did not consider important, that the allocator type parameter used to instantiate a container template affects the container’s type, thereby making it incompatible with containers employing a different allocation policy, but which otherwise have identical type. In our work, we have found it desirable, and often necessary, to customize the memory allocation for our containers and strings on a per-instance basis, without affecting the compile-time type of those containers or strings. Proper control over memory also required that objects within a container share an allocator with the container itself. Using an existing implementation of the C++ standard library as a base, we made backward-compatible modifications to enable such per-instance allocators. Our experience is that, once implemented, these modifications allowed us to use allocators in a wide range of situations to facilitate testing, efficient memory utilization, and even the prevention of memory leaks. This paper describes our allocator model and proposes changes to the upcoming revision of the standard library based on our experience.
Publication Year: 2005
Publication Date: 2005-01-01
Language: en
Type: article
Access and Citation
AI Researcher Chatbot
Get quick answers to your questions about the article from our AI researcher chatbot