Boost logo

Boost Users :

Subject: Re: [Boost-users] Fwd: Boost coroutine/context libraries
From: Oliver Kowalke (oliver.kowalke_at_[hidden])
Date: 2017-01-20 02:47:24


2017-01-18 20:38 GMT+01:00 Gregory Laird <glaird_at_[hidden]>:

> Question: If I allocate too small of a stack, and something gets written
> outside of the allocation, is there any way to know that this has occurred?
>

In the best case you get a segmentation fault (in worst case you get
undefined behaviour).

You could use the protected_fixedsize_stack allocator - it appends a guard
page at the end of the stack (only virtual addresses, no physical memory is
wasted). If you try to access memory from the guard page you get a
segmentation fault.
Another possibility is to use the segmented_stack allocator. It extends the
stack on demand (supported by gcc-4.7 onwards) - but you are forced to use
execution_context v1.



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net