C ++在libs之间混合new / delete? [英] C++ mix new/delete between libs?

查看:168
本文介绍了C ++在libs之间混合new / delete?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我在我的库中使用 new 关键字(与我的主应用程序不同),当我在主应用程序中使用删除,是否有可能导致崩溃/错误?

If I use the new keyword in my library (which is built differently than my main app), when I delete it in my main app with delete, is there a chance that I may get a crash/error?

推荐答案

。特别是你看到调试/释放堆是不同的问题,如果你的库使用placement new,或任何自定义堆你会有一个问题。调试/发布问题是迄今为止最常见的。

yes indeedy. In particular you see problems with debug/release heaps being different, also if your library uses placement new, or any custom heap you'll have a problem. The Debug/Release issue is by far the most common though.

这篇关于C ++在libs之间混合new / delete?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆