在vc中加入
#define _CRTDBG_MAP_ALLOC
#include "stdlib.h"
#include <crtdbg.h>
以及在程序最后加入 _CrtSetReportMode(_CRT_ERROR,_CRTDBG_MODE_DEBUG); _CrtDumpMemoryLeaks();
检测内存泄露,结果如下:
Detected memory leaks!
Dumping objects ->
C:\Users\chubin\Desktop\117一号车位dixiacheweiC\chewei.c(117) : {9663} normal block at 0x02C68800, 112829 bytes long.
Data: <4AFL[b_\a^_MF& > 34 41 46 4C 5B 62 5F 5C 61 5E 5F 4D 46 26 18 1E
{4855} normal block at 0x017B3548, 12800 bytes long.
Data: < E xe@ E e@> A1 45 B6 F3 FD 78 65 40 A2 45 B6 F3 FD 98 65 40
{4854} normal block at 0x017B0300, 12800 bytes long.
Data: < E xe@ E xe@> A1 45 B6 F3 FD 78 65 40 A1 45 B6 F3 FD 78 65 40 结果中的第一个内存泄露双击可以找到泄露地点,而下面的其他泄露则无法通过双击查看,请问如何解决这个问题以解决内存泄露?
#define _CRTDBG_MAP_ALLOC
#include "stdlib.h"
#include <crtdbg.h>
以及在程序最后加入 _CrtSetReportMode(_CRT_ERROR,_CRTDBG_MODE_DEBUG); _CrtDumpMemoryLeaks();
检测内存泄露,结果如下:
Detected memory leaks!
Dumping objects ->
C:\Users\chubin\Desktop\117一号车位dixiacheweiC\chewei.c(117) : {9663} normal block at 0x02C68800, 112829 bytes long.
Data: <4AFL[b_\a^_MF& > 34 41 46 4C 5B 62 5F 5C 61 5E 5F 4D 46 26 18 1E
{4855} normal block at 0x017B3548, 12800 bytes long.
Data: < E xe@ E e@> A1 45 B6 F3 FD 78 65 40 A2 45 B6 F3 FD 98 65 40
{4854} normal block at 0x017B0300, 12800 bytes long.
Data: < E xe@ E xe@> A1 45 B6 F3 FD 78 65 40 A1 45 B6 F3 FD 78 65 40 结果中的第一个内存泄露双击可以找到泄露地点,而下面的其他泄露则无法通过双击查看,请问如何解决这个问题以解决内存泄露?
#ifdef _DEBUG
#define new DEBUG_NEW
........
#define new DEBUG_NEW
#endif
还是没有办法双击查找到错误.....