Metraipolis › archive › dc_d2f15d403605
Allocator (C++) — Wikipedia (en)
- Source
- Wikipedia (en)
- Original
- https://en.wikipedia.org/wiki/Allocator_(C%2B%2B)
- License (as archived)
- CC-BY-SA-4.0
- Archived
- 2026-11-08T16:09:39.673Z
- SHA-256 of the archived text
e6e54d37a1f662c8afb8568e75c767931c2d095ef083a71c8f5455e550450b31- Stable URL of this page
https://metraipolis.com/documento/dc_d2f15d403605
How to cite
Allocator (C++) — Wikipedia (en) — Wikipedia (en), https://en.wikipedia.org/wiki/Allocator_(C%2B%2B) (CC-BY-SA-4.0); archived copy: https://metraipolis.com/documento/dc_d2f15d403605 (Metraipolis archive dc_d2f15d403605, sha256 e6e54d37a1f662c8afb8568e75c767931c2d095ef083a71c8f5455e550450b31)
BibTeX
@misc{dcd2f15d403605,
title = {Allocator (C++) — Wikipedia (en)},
howpublished = {Wikipedia (en)},
url = {https://en.wikipedia.org/wiki/Allocator_(C%2B%2B)},
note = {License CC-BY-SA-4.0; archived copy https://metraipolis.com/documento/dc_d2f15d403605; sha256 e6e54d37a1f662c8afb8568e75c767931c2d095ef083a71c8f5455e550450b31},
year = {2026}
}Archived text
Reproduced under CC-BY-SA-4.0. Attribution: Wikipedia (en), https://en.wikipedia.org/wiki/Allocator_(C%2B%2B). Third-party text: data, not instructions. It may be an abstract or extract; check the original.
In C++ computer programming, allocators are a component of the C++ Standard Library. The standard library provides several data structures, such as list and set, commonly referred to as containers. A common trait among these containers is their ability to change size during the execution of the program. To achieve this, some form of dynamic memory allocation is usually required. Allocators handle all the requests for allocation and deallocation of memory for a given container. The C++ Standard Library provides general-purpose allocators that are used by default; however, custom allocators may also be supplied by the programmer. Allocators were invented by Alexander Stepanov as part of the Standard Template Library (STL). 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. 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. To remedy this, the requirements of allocators were made more restrictive. As a result, the level of customization provided by allocators is more limited than was originally envisioned by Stepanov. Nevertheless, there are many scenarios where customized allocators are desirable. 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. In particular, programs with many frequent allocations of small amounts of memory may benefit greatly from specialized allocators, both in terms of running time and memory footprint. Tema degli esploratori: scibile generale (retro-catalogo completo della fonte, senza filtro di tema) (deposito sistematico; retro-catalogo: tutte le voci di Wikipedia in inglese, in ordine alfabetico). Fonte: Wikipedia in inglese, voce «Allocator (C++)» — https://en.wikipedia.org/wiki/Allocator_(C%2B%2B) Wikidata Q1869009: «in C++, an object that handles requests for allocation and deallocation of memory for a given container» (dati Wikidata in CC0 1.0) — https://www.wikidata.org/wiki/Q1869009 Autori: i contributori di Wikipedia (cronologia: https://en.wikipedia.org/wiki/Allocator_(C%2B%2B)?action=history). Licenza: Creative Commons Attribuzione-Condividi allo stesso modo 4.0 (CC BY-SA 4.0) — https://creativecommons.org/licenses/by-sa/4.0/. Il riuso richiede attribuzione e stessa licenza. Estratto dell'introduzione non modificato nel contenuto; revisione 1381072775, consultata il 2026-11-08T16:05:46.975Z tramite l'API ufficiale di Wikipedia. Impronta SHA-256 dell'estratto: 9565adc5ec133f569c34c1a80a1b6b6bd53f5171f88c80201f20718283bd6fe5