问题描述
- 请哪位大神帮忙解决下这个问题-内存泄露
-
请哪位大神帮忙解决下这个问题,实在是找不到哪个地方内存泄露,凡是代码中用到new的,我都delete了。。。
Detected memory leaks!
Dumping objects ->
{107} normal block at 0x00206188, 21 bytes long.
Data: < l| > A8 6C 7C 00 04 00 00 00 04 00 00 00 01 00 00 00
{106} normal block at 0x00206130, 21 bytes long.
Data: < l| > A8 6C 7C 00 04 00 00 00 04 00 00 00 01 00 00 00
{105} normal block at 0x002060D8, 28 bytes long.
Data: < l| > A8 6C 7C 00 0B 00 00 00 0B 00 00 00 01 00 00 00
{76} normal block at 0x00205010, 49 bytes long.
Data: < l| > A8 6C 7C 00 04 00 00 00 20 00 00 00 01 00 00 00
f:rtmvctoolsvc7libsshipatlmfcsrcmfcoccmgr.cpp(195) : {75} normal block at 0x00204F30, 160 bytes long.
Data: < > E8 03 00 00 00 00 00 00 FF FF FF FF 00 00 00 00
{74} normal block at 0x00204EA0, 84 bytes long.
Data: < > FF FF FF FF 00 00 00 00 00 00 00 00 00 00 00 00
Object dump complete.
解决方案
在app类的构造函数中调用
_CrtSetBreakAlloc(107) 定位第一个
程序中断后 调用堆栈 查看 泄露的位置
解决方案二:
C******App::C****App()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
_CrtSetBreakAlloc(107);
}
如果是win32 程序的话 按f10 然后 在监视窗口输入 _crtBreakAlloc 修改为107 然后f5继续
解决方案三:
推荐看看这篇文章吧http://blog.csdn.net/phinecos/article/details/4745720
时间: 2025-01-25 01:30:02