Allocator (C++)

allocatorsAllocatorC++ allocators
In C++ computer programming, allocators are a component of the C++ Standard Library.wikipedia
62 Related Articles

Standard Template Library

STLC++ STLC++ Standard Template Library
Allocators were invented by Alexander Stepanov as part of the Standard Template Library (STL).

C++11

C++0xmove constructorconstexpr
The 2011 revision of the C++ Standard removed the weasel words requiring that allocators of a given type always compare equal and use normal pointers.
Among the many areas of improvement considered were standard library allocators.

Modern C++ Design

Policy-based designLokiLoki (C++)
The subject of custom allocators has been treated by many C++ experts and authors, including Scott Meyers in Effective STL and Andrei Alexandrescu in Modern C++ Design.
Previous examples of this design approach, based on parameterized generic code, include parametric modules (functors) of the ML languages, and C++ allocators for memory management policy.

Placement syntax

placement placement new
The above code uses the placement syntax, and calls the destructor directly.
Placement syntax is also employed for custom allocators.

Sequence container (C++)

vector array
This approach may work well with containers that mostly allocate large chunks of memory, like vector and deque.
By design, the container does not support allocators.

Computer programming

programmingcodingprogrammable
In C++ computer programming, allocators are a component of the C++ Standard Library.

C++ Standard Library

libstdc++standard libraryits standard library
In C++ computer programming, allocators are a component of the C++ Standard Library.

Library (computing)

librarylibrariessoftware library
The standard library provides several data structures, such as list and set, commonly referred to as containers.

Data structure

data structuresstructurestructures
The standard library provides several data structures, such as list and set, commonly referred to as containers.

List (abstract data type)

listlistsList (computing)
The standard library provides several data structures, such as list and set, commonly referred to as containers.

Set (abstract data type)

setsetsset data structure
The standard library provides several data structures, such as list and set, commonly referred to as containers.

Collection (abstract data type)

collectioncontainercontainers
The standard library provides several data structures, such as list and set, commonly referred to as containers.

Runtime (program lifecycle phase)

run timerun-timeruntime
A common trait among these containers is their ability to change size during the execution of the program.

Computer program

programprogramscomputer programs
A common trait among these containers is their ability to change size during the execution of the program.

Memory management

heapmemory allocationdynamic memory allocation
To achieve this, some form of dynamic memory allocation is usually required.

Manual memory management

allocation and deallocationmanually
Allocators handle all the requests for allocation and deallocation of memory for a given container.

Programmer

software developercomputer programmerdeveloper
The C++ Standard Library provides general-purpose allocators that are used by default, however, custom allocators may also be supplied by the programmer.

Alexander Stepanov

Alex Stepanov
Allocators were invented by Alexander Stepanov as part of the Standard Template Library (STL).

Intel Memory Model

memory model8086 memory modelsC++
They were originally intended as a means to make the library more flexible and independent of the underlying memory model, allowing programmers to utilize custom pointer and reference types with the library.

Pointer (computer programming)

pointerpointerspointer arithmetic
They were originally intended as a means to make the library more flexible and independent of the underlying memory model, allowing programmers to utilize custom pointer and reference types with the library.

Reference (C++)

referencepass-by-referencethose in C++
They were originally intended as a means to make the library more flexible and independent of the underlying memory model, allowing programmers to utilize custom pointer and reference types with the library.

C++

C++ programming languageC++98C with Classes
The subject of custom allocators has been treated by many C++ experts and authors, including Scott Meyers in Effective STL and Andrei Alexandrescu in Modern C++ Design. In C++ computer programming, allocators are a component of the C++ Standard Library. However, in the process of adopting STL into the C++ standard, the C++ standardization committee realized that a complete abstraction of the memory model would incur unacceptable performance penalties.

Abstraction (computer science)

abstractiondata abstractionabstract
However, in the process of adopting STL into the C++ standard, the C++ standardization committee realized that a complete abstraction of the memory model would incur unacceptable performance penalties.

Computer performance

performanceprocessing powercomputing power
However, in the process of adopting STL into the C++ standard, the C++ standardization committee realized that a complete abstraction of the memory model would incur unacceptable performance penalties.

Memory pool

poolblock
Some of the most common reasons for writing custom allocators include improving performance of allocations by using memory pools, and encapsulating access to different types of memory, like shared memory or garbage-collected memory.