请教,利用VC检测内存泄露的问题
#ifdef _DEBUG
#define _CRTDBG_MAP_ALLOC
#include<stdlib.h>
#include<crtdbg.h>
#endif
在程序的退出点添加了如下代码:
#ifdef _DEBUG
_CrtDumpMemoryLeaks();
#endif
当我运行Debug模式并退出程序时,有如下输出:
f:\program files\microsoft visual studio\vc98\include\crtdbg.h(552) : {324230} normal block at 0x011100B0, 33 bytes long.
Data: < 1 > 00 31 00 CD CD CD CD CD CD CD CD CD CD CD CD CD
f:\program files\microsoft visual studio\vc98\include\crtdbg.h(552) : {324228} normal block at 0x031E7768, 33 bytes long.
Data: < 0 > 00 30 00 CD CD CD CD CD CD CD CD CD CD CD CD CD
f:\program files\microsoft visual studio\vc98\include\crtdbg.h(552) : {324176} normal block at 0x03095058, 33 bytes long.
Data: < identify_text > 00 69 64 65 6E 74 69 66 79 5F 74 65 78 74 00 CD
f:\program files\microsoft visual studio\vc98\include\crtdbg.h(552) : {324175} normal block at 0x033C5250, 116 bytes long.
Data: < Q ~ > F0 ED 51 00 00 00 00 00 7E 00 00 00 00 00 00 00
f:\program files\microsoft visual studio\vc98\include\crtdbg.h(552) : {324174} normal block at 0x030950C0, 33 bytes long.
Data: < 1 > 00 31 00 CD CD CD CD CD CD CD CD CD CD CD CD CD
f:\program files\microsoft visual studio\vc98\include\crtdbg.h(552) : {324173} normal block at 0x030953B8, 60 bytes long.
Data: <4|Q r > 34 7C 51 00 00 00 00 00 72 00 00 00 00 00 00 00
f:\program files\microsoft visual studio\vc98\include\crtdbg.h(552) : {324171} normal block at 0x03092508, 33 bytes long.
Data: < sence_id > 00 73 65 6E 63 65 5F 69 64 00 CD CD CD CD CD CD
f:\program files\microsoft visual studio\vc98\include\crtdbg.h(552) : {324170} normal block at 0x03093EA0, 116 bytes long.
Data: < Q h > F0 ED 51 00 00 00 00 00 68 00 00 00 00 00 00 00
f:\program files\microsoft visual studio\vc98\include\crtdbg.h(552) : {324169} normal block at 0x03092570, 33 bytes long.
Data: < 0 > 00 30 00 CD CD CD CD CD CD CD CD CD CD CD CD CD
f:\program files\microsoft visual studio\vc98\include\crtdbg.h(552) : {324168} normal block at 0x031A8ED0, 60 bytes long.
Data: <4|Q \ > 34 7C 51 00 00 00 00 00 5C 00 00 00 00 00 00 00
f:\program files\microsoft visual studio\vc98\include\crtdbg.h(552) : {324166} normal block at 0x030B93E0, 33 bytes long.
Data: < flash_id > 00 66 6C 61 73 68 5F 69 64 00 CD CD CD CD CD CD
f:\program files\microsoft visual studio\vc98\include\crtdbg.h(552) : {324165} normal block at 0x030910C8, 116 bytes long.
Data: < Q R > F0 ED 51 00 00 00 00 00 52 00 00 00 00 00 00 00
f:\program files\microsoft visual studio\vc98\include\crtdbg.h(552) : {324164} normal block at 0x030B9448, 33 bytes long.
Data: < 0 > 00 30 00 CD CD CD CD CD CD CD CD CD CD CD CD CD
f:\program files\microsoft visual studio\vc98\include\crtdbg.h(552) : {324163} normal block at 0x030920D0, 60 bytes long.
Data: <4|Q D > 34 7C 51 00 00 00 00 00 44 00 00 00 00 00 00 00
f:\program files\microsoft visual studio\vc98\include\crtdbg.h(552) : {324161} normal block at 0x0316B648, 33 bytes long.
Data: < contr_type > 00 63 6F 6E 74 72 5F 74 79 70 65 00 CD CD CD CD
f:\program files\microsoft visual studio\vc98\include\crtdbg.h(552) : {324160} normal block at 0x034BE408, 116 bytes long.
Data: < Q 8 > F0 ED 51 00 00 00 00 00 38 00 00 00 00 00 00 00
f:\program files\microsoft visual studio\vc98\include\crtdbg.h(552) : {324158} normal block at 0x0316EC98, 33 bytes long.
Data: < identify_msg > 00 69 64 65 6E 74 69 66 79 5F 6D 73 67 00 CD CD
f:\program files\microsoft visual studio\vc98\include\crtdbg.h(552) : {324157} normal block at 0x0323A280, 116 bytes long.
Data: < Q * > F0 ED 51 00 00 00 00 00 2A 00 00 00 00 00 00 00
f:\program files\microsoft visual studio\vc98\include\crtdbg.h(552) : {324156} normal block at 0x0316EC30, 33 bytes long.
Data: < SHIFT-JIS > 00 53 48 49 46 54 2D 4A 49 53 00 CD CD CD CD CD
f:\program files\microsoft visual studio\vc98\include\crtdbg.h(552) : {324153} normal block at 0x0316BF50, 33 bytes long.
Data: < 1.0 > 00 31 2E 30 00 CD CD CD CD CD CD CD CD CD CD CD
f:\program files\microsoft visual studio\vc98\include\crtdbg.h(552) : {324150} normal block at 0x0310B240, 104 bytes long.
Data: <D Q > 44 EF 51 00 00 00 00 00 00 00 00 00 00 00 00 00
。。。。。。。。。。
这个报告指明产生内存泄露问题的内存申请点是:(在crtdbg.h文件中)
#ifdef _CRTDBG_MAP_ALLOC
inline void* __cdecl operator new(unsigned int s)
{ return ::operator new(s, _NORMAL_BLOCK, __FILE__, __LINE__); }
#endif /* _CRTDBG_MAP_ALLOC */
我本来是要定位自己的源代码文件中产生内存泄露问题的内存申请点的,结果全指向了crtdbg.h中的这一条语句,这样我就不知道在哪一块申请的内存造成了内存泄露。
请教各位高手,我该如何解决这个问题,才能使我的内存泄露检测变得有意义?多谢了。
相关推荐
基于SpringBoot+vue的高校学科竞赛平台.zip
springboot 基于SpringBoot+vue的高校学科竞赛平台
基于Springboot+Vue高校学科竞赛平台源码案例设计.zip
代码详情请到资源详情查看。
【springboot9064】基于springboot+vue的高校学科竞赛平台.zip
技术选型 【后端】:Java 【框架】:springboot 【前端】:vue 【JDK版本】:JDK1.8 【服务器】:tomcat7+ 【数据库】:mysql 5.7+ 包含:项目源码、数据库脚本、项目功能介绍文档等,该项目源码可作为毕设使用。 项目都经过严格调试,确保可以运行! 具体项目介绍可查看博主文章
【9064】基于springboot+vue的高校学科竞赛平台.zip
技术选型 【后端】:Java 【框架】:springboot 【前端】:vue 【JDK版本】:JDK1.8 【数据库】:mysql 5.7+ 资源包含项目源码+数据库脚本+万字文档。 项目包含前后台完整源码,都经过本人调试,确保可以正常运行! 具体项目介绍可查看博主文章或私聊获取。 也可提供远程调试、二次开发、项目讲解服务,有意向可私聊。 助力学习实践,提升编程技能,快来获取这份宝贵的资源吧!
基于springboot开发高校学科竞赛平台vue+mysql+论文(毕业设计).zip
本项目是一套基于SpringBoot开发的高校学科竞赛平台,集成了Vue前端技术和MySQL数据库,专为计算机相关专业的毕业生和Java学习者提供毕业设计和项目实战练习的高分资源。该平台不仅提供了完整的项目源码、数据库脚本和详细的项目说明,还附带论文参考资料,可以直接作为毕业设计使用,助力学生轻松完成课程设计或毕业设计,获得优异成绩。 在技术实现方面,后台框架采用了当前流行的SpringBoot,以其简化配置和快速开发的特点,为开发者提供了一个高效、稳定的后端环境。数据库方面,选择了广泛应用在全球的MySQL,确保数据处理的高效与安全。整个开发环境包括JDK、IDEA和Tomcat等工具,为开发者提供了一个完整的开发、调试和部署环境。所有项目均已经过严格测试,确保能够顺利运行,用户可以放心下载使用! 对于有一定基础的开发者,本项目的代码结构清晰,文档齐全,可以在此基础上进行修改和扩展,以实现更多个性化的功能需求。运行测试ok,毕业设计、课程设计高分资源,放心下载使用!


