Back to Arangodb

Stack allocation

3rdParty/boost/1.78.0/libs/context/doc/html/context/stack.html

3.12.9.22.5 KB
Original Source

| | Home | Libraries | People | FAQ | More |


Stack allocation

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

stack-allocator concept

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

|

expression

|

return type

|

notes

| | --- | --- | --- | |

a(size)

| |

creates a stack allocator

| |

a.allocate()

|

stack_context

|

creates a stack

| |

a.deallocate( sctx)

|

void

|

deallocates the stack created by a.allocate()

|

| | 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 | |

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

|

| | 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).

|

| | Copyright © 2014 Oliver Kowalke

Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

|