Since Release 23-10, AUTOSAR is specifying a backport of the standard C++ polymorphic allocator and memory resource classes, available since C++17 with API updates in C++20. These classes in namespace ara::core
are used as technical infrastructure of the Steady Mode MICROSAR Adaptive feature.
The Exceptionless Polymorphic Memory Framework
The AUTOSAR variant of polymorphic allocators (ara::core::PolymorphicAllocator
) and resources (implementations of ara::core::MemoryResource
) aims to stick as closely as possible to their C++ standard counterparts and expose almost the same behavior, except
- propagating allocation failures by returning null pointers rather than exceptions, and
- being supported with C++14.
Combination With C++ Standard Classes
The ara::core::PolymorphicAllocator
can be used with standard containers, because it almost meets the named allocator requirements. These, however, specify that allocation functions may throw exceptions, but not whether returned pointers to allocated storage may be null or not. Consequently, they do not require that standard container objects must handle null pointers when memory provisioning failed.
Examples for C++ standard containers are std::vector
, std::map
, or std::string
.
Examples for MICROSAR Adaptive containers are AUTOSAR ara::core::Vector
, ara::core::Map
, ara::core::String
, or their implementing delegates amsr::Vector
, amsr::Map
, amsr::String
.

When cross-connecting containers and allocators from both domains, extra measures are required to ensure well defined behavior in case of errors. See also amsr::AbortOnErrorResource
in Configuration.