| Home | Libraries | People | FAQ | More

#### Class fixedsize

__boost_coroutine__ provides the class fixedsize which models the stack-allocator concept. In contrast to protected_fixedsize it does not append a guard page at the end of each stack. The memory is simply managed by `std::malloc()` and `std::free()`.

    #include <boost/context/fixedsize.hpp>

    template< typename traitsT >
    struct basic_fixedsize
    {
        typedef traitT  traits_type;

        basic_fixesize(std::size_t size = traits_type::default_size());

        stack_context allocate();

        void deallocate( stack_context &);
    }

    typedef basic_fixedsize< stack_traits > fixedsize

###### `stack_context allocate()`

Preconditions:

  `traits_type::minimum:size() <= size` and `! traits_type::is_unbounded() && ( traits_type::maximum:size() >= size)`.

Effects:

  Allocates memory of at least `size` Bytes and stores a pointer to the stack and its actual size in `sctx`. Depending on the architecture (the stack grows downwards/upwards) the stored address is the highest/lowest address of the stack.

###### `void deallocate( stack_context & sctx)`

Preconditions:

  `sctx.sp` is valid, `traits_type::minimum:size() <= sctx.size` and `! traits_type::is_unbounded() && ( traits_type::maximum:size() >= sctx.size)`.

Effects:

  Deallocates the stack space.