VS Memory leaks (RichEdit2.0) and Access violation
2016-07-19 16:05
501 查看
Summary
Memory leaks RichEdit20
Access violation
Reference Link
So add the RichEdit2.0 initialize code as below,
Above code must be added before the Dialog Windows was showed, as below code,
This memory leak issue resolved.
The CLogger was destroyed as below code when exit,
The same instance was also destroyed at below code,
Delete the instance destroy code at one of these two places, problem resolved.
2,0xC0000005: Access violation reading location 0x00000008
Memory leaks RichEdit20
Access violation
Reference Link
Summary
When develop on a Windows application, solved memory leaks issue on RichEdit2.0, and pointer access violation exception.Memory leaks (RichEdit2.0)
It is very common to encounter memory leaks when using RichEdit2.0 in Visual Studio, as this RichEdit2.0 requires to be initialized. The error displays as below,Detected memory leaks! Dumping objects -> f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\occmgr.cpp(195) : {335} normal block at 0x00FDAA00, 80 bytes long. Data: < > 01 00 00 00 00 00 00 00 FF FF FF FF 00 00 00 00 f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\occmgr.cpp(181) : {334} normal block at 0x032E1F88, 44 bytes long. Data: < > FF FF FF FF 00 00 00 00 00 00 00 00 00 00 00 00 Object dump complete.
So add the RichEdit2.0 initialize code as below,
//for RichEdit2.0 if (!AfxInitRichEdit2()) { msg = _T("Error in RichEdit 2.0 initialization!"); MessageBox(NULL, msg, _T("Fatal"), MB_ICONSTOP|MB_OK); }
Above code must be added before the Dialog Windows was showed, as below code,
CAPDURunDlg dlg; m_pMainWnd = &dlg; INT_PTR nResponse = dlg.DoModal(); if (nResponse == IDOK) { // TODO: Place code here to handle when the dialog is // dismissed with OK } else if (nResponse == IDCANCEL) { // TODO: Place code here to handle when the dialog is // dismissed with Cancel }
This memory leak issue resolved.
Access violation
Encountered below issue unhandled exception issue when exit the application, it caused by additional destroyed the instances, i.e. I destroyed the instance twice when exit the application.Unhandled exception at 0x78d2b4ec (mfc90ud.dll) in APDURun.exe: 0xC0000005: Access violation reading location 0xfeeefeee.
The CLogger was destroyed as below code when exit,
BOOL CAPDURunDlg::DestroyWindow() { // TODO: Add your specialized code here and/or call the base class //CLogger::DestroyInstance(); return CDialog::DestroyWindow(); }
The same instance was also destroyed at below code,
int CAPDURunApp::ExitInstance() { // TODO: Add your specialized code here and/or call the base class CLogger::DestroyInstance(); return CWinAppEx::ExitInstance(); }
Delete the instance destroy code at one of these two places, problem resolved.
Reference Link
1, fail-to-debug-the-program2,0xC0000005: Access violation reading location 0x00000008
相关文章推荐
- Access 2000 数据库 80 万记录通用快速分页类
- 十万条Access数据表分页的两个解决方法
- VB6实现连接Access数据库的ADODB代码实现方法
- Access中字段上自动打开的输入法的解决方法
- Access to SQLserver 数据库生迁脚本编写器(DB_CreateSqlEV1.06下载)
- asp Access数据备份,还原,压缩类代码
- VB使用ADO操作Access数据库
- Access转成SQL数据库的方法
- 文本、Excel、Access数据导入SQL Server2000的方法
- Access 数据类型与 MS SQL 数据类型的相应
- ASP代码实现自动清除替换ACCESS(MDB)数据库的日文字符的
- 通过asp程序来创建access数据库
- Access转SqlServer的注意事项
- SQL Server数据复制到的Access两步走
- Access和SQL Server里面的SQL语句的不同之处
- ACCESS数据库修改自动编号的ID值为零的方法分享
- access 数据库自启动困难解决方法
- access的备注字段限制64K
- Access出现"所有记录中均未找到搜索关键字"的错误解决
- 中文Access2000速成教程--1.8 定义表之间的关系