程序连续运转三天过后,在debug版本下出现如下提示:
Debug Assertion Failed
Progtam:c:\pepoleorientation\pd.exe
File:e:\Program files\microsoft viusal studio.net 2003\vc7\atlmfc\include\atlsimpstr.h
Line:778
Expression:pOldData->nAllocLength<nLength
For information on how you program can cause an assertion
failue,see the visual c++ documentation on asserts
(Press Retry to debug the application)
终止 重试 忽略
--------------------------------------------
我看了提示文件的源码
ATL_NOINLINE void Reallocate( int nLength )
{
CStringData* pOldData = GetData();
ATLASSERT( pOldData->nAllocLength < nLength );////这里是778行
IAtlStringMgr* pStringMgr = pOldData->pStringMgr;
CStringData* pNewData = pStringMgr->Reallocate( pOldData, nLength, sizeof( XCHAR ) );
if( pNewData == NULL )
{
ThrowMemoryException();
}
Attach( pNewData );
}
---------------------------------------
ATLASSERT( pOldData->nAllocLength < nLength );////这里是778行
请问大家可能造成这个错误的常见操作是那些?举个示例.推荐个标准写法.
Debug Assertion Failed
Progtam:c:\pepoleorientation\pd.exe
File:e:\Program files\microsoft viusal studio.net 2003\vc7\atlmfc\include\atlsimpstr.h
Line:778
Expression:pOldData->nAllocLength<nLength
For information on how you program can cause an assertion
failue,see the visual c++ documentation on asserts
(Press Retry to debug the application)
终止 重试 忽略
--------------------------------------------
我看了提示文件的源码
ATL_NOINLINE void Reallocate( int nLength )
{
CStringData* pOldData = GetData();
ATLASSERT( pOldData->nAllocLength < nLength );////这里是778行
IAtlStringMgr* pStringMgr = pOldData->pStringMgr;
CStringData* pNewData = pStringMgr->Reallocate( pOldData, nLength, sizeof( XCHAR ) );
if( pNewData == NULL )
{
ThrowMemoryException();
}
Attach( pNewData );
}
---------------------------------------
ATLASSERT( pOldData->nAllocLength < nLength );////这里是778行
请问大家可能造成这个错误的常见操作是那些?举个示例.推荐个标准写法.
解决方案 »
- 我现在双击对话框,原来是出现对话框编辑器,现在出现mfcclasswizard,怎么改回去?
- 新手急救,单文本界面上有固定的对话框,怎么实现??
- MFC MDI窗口菜单栏重绘的问题
- 求助:谁有The Laplacian Pyramid as a Compact Image Code.pdf中文的啊,看得我头晕,严重影响我的理解
- CEdit里的字体变大了,输入的字体怎么显示不全呀?谢谢
- 请问:能否将CListCtrl的一列或一行设为不可见,不要删除?
- 如何获得数据库中的所有表名,请指教,急!在线等,给100分,谢谢!
- 求 SUSAN corner detector 算法的源代码
- VC全局函数问题??
- 想不明白,我想请教关于多语言混合编程的问题。
- 请问如何获取控制面板"区域和语言选项"里的"位置"设置
- CString 类型的变量 如何转换成CTime类型??
找一下代码中有没有用类似strcpy这样函数你看出错后有没有内存泄露
nkwesley(江南丝竹) ( ) 信誉:146 2006-02-24 08:55:00 得分: 0
应该是越界
找一下代码中有没有用类似strcpy这样函数你看出错后有没有内存泄露----
程序中赋值都是使用的=操作
也没有使用strcpy
-----------------------------------------------------------------------------
或者想法加输出语句
=========================================================================
你必须要找到问题的所在,这样才能对症下药。
你可以重载CString类,(CMyString),然后里面将每个地方使用CString的操作位置记录到文件里,这样不就可以找到你程序中错误的地方了。
自己负责越界问题
装程序,跟踪statck了。唯一的办法
:-(
大家难道没有遇到过这样的问题吗?
用了GetBuffer就ReleaseBuffer
但是我不知道这样有没有潜在问题,理论上好象没有
while(true)
{
CString m_str;
m_str=" ";
......}
既然是ASSERT了,就说明pOldData->nAllocLength < nLength 这个表达式是FALSE。你应该检查为什么pOldData->nAllocLength < nLength 不成立了。