- Hands-On High Performance Programming with Qt 5
- Marek Krajewski
- 106字
- 2021-07-02 13:53:57
Non-determinism
The second runtime problem is the non-determinism of exceptions—we just cannot say how long it will take to handle a thrown exception! And as new exceptions can be generated in the handler of the current exception, there can be multiple exceptions in flight, which cannot be folded using normal optimizations, so they will require an arbitrary amount of memory too.
When allocating memory for an exception, we either use dynamic allocation, which requires unpredictable amounts of time in general, or the current stack, which must however be partially preserved, leading to dead-stack-pinning techniques for potentially several exceptions in flight, multiplying the stack usage.