Why is vector deleting destructor being called as a result of a scalar delete?

后端 未结 5 1629
轮回少年
轮回少年 2020-12-31 11:23

I have some code that is crashing in a large system. However, the code essentially boils down to the following pseudo-code. I\'ve removed much of the detail, as I have tried

5条回答
  •  孤城傲影
    2020-12-31 11:54

    Sounds like this could be an issue of allocating off of one heap and trying to delete on another. This can be an issue when allocating objects from a dll as the dll has its own heap. From the code you're showing it doesn't seem like this would be the problem but maybe in the simplification something was lost? In the past I've see code like this use factory functions and virtual destroy methods on the objects to make sure that the allocation and deletion happens in the dll code.

提交回复
热议问题