CRT detected that the application wrote to memory 内存写错误
来源:互联网 发布:python mvc框架 编辑:程序博客网 时间:2024/06/02 02:28
今天在别人写的程序上做新功能,析构的时候发现:CRT detected that the application wrote to memory 内存写错误,经过跟踪调试,发现在遍历delete A->listB 的时候 listB里又循环嵌套了A, 也就是说已经把A deleted 了,但是没设为NULL, 于是之后再次delete A 变出现错误, 也就是所谓的"野指针", ,他们居然不写个safe_delete宏, 害我跟了半天.
以后凡是报此类问题,皆是操作了未new的内存,
1.数组越界操作
2.DELETE后没有设NULL, 野指针
Reference:http://hi.baidu.com/kidcdf/blog/item/c886b34bd123b3fb83025c64.html
但是还有一种情况,根据我猜测和测试 由于宏而引起的,这种宏主要存在于头文件中才会导致内存写错误,举个例子吧:
去掉头文件中的宏,就不会出现内存写错误,具体为什么 还在研究中
#pragma once#ifndef USE_EMULATIONclass CEmulation;#endifclass Test{public: Test(); ~Test(); ......private: ...... #ifdef USE_EMULATION CEmulation* m_pEmulation; #endif};
....Test::Test(){#ifdef USE_MULATION m_pEmulation = new CEmulation();#endif}~Test::Test(){ #ifdef USE_MULATION delete m_pEmulation; m_pEmulation = NULL;#endif}.....
- CRT detected that the application wrote to memory 内存写错误
- 内存错误:CRT detected that the application wrote to memory after end of heap buffer
- 内存错误:CRT detected that the application wrote to memory after end of heap buffer
- 释放内存free()错误:CRT detected that the application wrote to memory after end of heap buffer:内存访问违规
- 编译错误----CRT detected that the application wrote to memory after end of heap buffer
- 调试错误 - CRT detected that the application wrote to memory after end of heap buffer
- heap corruption detected: CRT detected that the application wrote to memory
- CRT detected that the application wrote to memory after after the end of heap buffer
- CRT detected that the application wrote to memory after end of the head buff怎么回事
- CRT detected that the application wrote to memory after end of heap buffer 问题(转)
- CRT detected that the application wrote to memory after end of heap buffer
- CRT detected that the application wrote to memory after end of heap buffer
- CRT detected that the application wrote to memory after end of heap buffer
- CRT detected that the application wrote to memory after end of heap buffer
- CRT detected that the application wrote to memory after end of heap buffer
- CRT detected that the application wrote to memory after end of heap buffer
- CRT detected that the application wrote to memory after end of heap buffer
- crt detected that the application wrote to memory after end of heap buffer
- C++ string详解
- 正则表达式学习(验证输入是否颜色值)
- Directx 3D —— 如何使用全屏模式
- SQL语句大全
- android面试题总结
- CRT detected that the application wrote to memory 内存写错误
- 命令行访问iphone的几种方式
- 整理uc/os的46个函数
- RTCP协议详解
- char、nvarchar和varchar区别
- 黑马程序员_Java中的反射
- [StoryToolKit] STK工具箱的源代码
- 常见经典排序算法
- Windows 2003,XP安装Windows Phone 7