Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for a snapshot of the develop branch, built from commit 6fa1c7e99b.

Stack allocation

Class protected_fixedsize
Class pooled_fixedsize_stack
Class fixedsize_stack
Class segmented_stack
Class stack_traits
Class stack_context
Support for valgrind
Support for sanitizers

The memory used by the stack is allocated/deallocated via a stack-allocator which is required to model a stack-allocator concept.

stack-allocator concept

A stack-allocator must satisfy the stack-allocator concept requirements shown in the following table, in which a is an object of a stack-allocator type, sctx is a stack_context, and size is a std::size_t:


return type



creates a stack allocator



creates a stack

a.deallocate( sctx)


deallocates the stack created by a.allocate()

[Important] Important

The implementation of allocate() might include logic to protect against exceeding the context's available stack size rather than leaving it as undefined behaviour.

[Important] Important

Calling deallocate() with a stack_context not set by allocate() results in undefined behaviour.

[Note] Note

The stack is not required to be aligned; alignment takes place inside execution_context.

[Note] Note

Depending on the architecture allocate() stores an address from the top of the stack (growing downwards) or the bottom of the stack (growing upwards).