Under what circumstances are C++ destructors not going to be called?

前端 未结 8 877
-上瘾入骨i
-上瘾入骨i 2020-12-02 08:52

I know that my destructors are called on normal unwind of stack and when exceptions are thrown, but not when exit() is called.

Are there any other cases where my des

8条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-02 09:37

    A lot of answers here but still incomplete!

    I found another case where destructors are not executed. This happens always when the exception is catched across a library boundary.

    See more details here:

    Destructors not executed (no stack unwinding) when exception is thrown

提交回复
热议问题