zhaowd2001@yahoo.com

zhaowd2001@yahoo.com
数据加载中……

Heap error in Visual Studio 2005 Pro C++

大家有什么方法能确定是哪段代码非法修改啦内存?

环境:
windows xp sp2 中文版, Visual Studio 2005 Professional Edition

Output window:

HEAP[fxecgSUD.exe]: Heap block at 00E4BF10 modified at 00E4BEFC past requested size of ffffffe4

Windows has triggered a breakpoint in fxecgSUD.exe.

This may be due to a corruption of the heap, and indicates a bug in fxecgSUD.exe or any of the DLLs it has loaded.

The output window may have more diagnostic information

 

出错位置:(出错位置不确定)

AFX_MODULE_THREAD_STATE* AFXAPI AfxGetModuleThreadState()

{

     è 出错位置 AFX_MODULE_THREAD_STATE* pResult=AfxGetModuleState()->m_thread.GetData();

     ENSURE(pResult != NULL);

     return pResult;

}

 

调用堆栈:

              ntdll.dll!7c921230()   

         [Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]  

         ntdll.dll!7c98c943()    

         ntdll.dll!7c969a2e()    

         ntdll.dll!7c9469a9()    

         ntdll.dll!7c931bff()     

         ntdll.dll!7c931e2e()    

         ntdll.dll!7c969b34()   

         ntdll.dll!7c94a67e()    

         ntdll.dll!7c946abe()    

         ntdll.dll!7c97db5c()    

         ntdll.dll!7c98e062()    

         ntdll.dll!7c98cde9()    

         ntdll.dll!7c96a5d0()    

         ntdll.dll!7c98e0f0()    

         ntdll.dll!7c98e0d4()    

>       fxecgSUD.exe!AfxGetModuleThreadState()  Line 464 + 0xf bytes     C++

         ntdll.dll!7c98e0d4()    

         ntdll.dll!7c96a5d0()    

         ntdll.dll!7c946abe()    

         user32.dll!77d18816()         

         ntdll.dll!7c9468ad()    

         ntdll.dll!7c97db5c()    

         ntdll.dll!7c98cd11()    

         ntdll.dll!7c980af8()    

         ntdll.dll!7c980bf0()    

         ntdll.dll!7c980bcc()    

         fxecgSUD.exe!std::_Iterator_base::~_Iterator_base()  Line 151 + 0x1e bytes        C++

         fxecgSUD.exe!_free_base(void * pBlock=0x00e4dde0)  Line 109 + 0x12 bytes    C

         fxecgSUD.exe!_free_dbg_nolock(void * pUserData=0x00e4de00, int nBlockUse=1)  Line 1329 + 0x9 bytes    C++

         fxecgSUD.exe!_free_dbg(void * pUserData=0x00e4de00, int nBlockUse=1)  Line 1194 + 0xd bytes       C++

         fxecgSUD.exe!operator delete(void * p=0x00e4de00)  Line 373 + 0xb bytes        C++

         fxecgSUD.exe!std::allocator<std::_Tree_nod<std::_Tmap_traits<CPropertyPage const * const,TreePropSheet::CTreePropSheetBase::CPageInformation,std::less<CPropertyPage const * const>,std::allocator<std::pair<CPropertyPage const * const,TreePropSheet::CTreePropSheetBase::CPageInformation> >,0> >::_Node>::deallocate(std::_Tree_nod<std::_Tmap_traits<CPropertyPage const * const,TreePropSheet::CTreePropSheetBase::CPageInformation,std::less<CPropertyPage const * const>,std::allocator<std::pair<CPropertyPage const * const,TreePropSheet::CTreePropSheetBase::CPageInformation> >,0> >::_Node * _Ptr=0x00e4de00, unsigned int __formal=1)  Line 141 + 0x9 bytes         C++

         fxecgSUD.exe!std::_Tree<std::_Tmap_traits<CPropertyPage const * const,TreePropSheet::CTreePropSheetBase::CPageInformation,std::less<CPropertyPage const * const>,std::allocator<std::pair<CPropertyPage const * const,TreePropSheet::CTreePropSheetBase::CPageInformation> >,0> >::_Tidy()  Line 1332         C++

         fxecgSUD.exe!std::_Tree<std::_Tmap_traits<CPropertyPage const * const,TreePropSheet::CTreePropSheetBase::CPageInformation,std::less<CPropertyPage const * const>,std::allocator<std::pair<CPropertyPage const * const,TreePropSheet::CTreePropSheetBase::CPageInformation> >,0> >::~_Tree<std::_Tmap_traits<CPropertyPage const * const,TreePropSheet::CTreePropSheetBase::CPageInformation,std::less<CPropertyPage const * const>,std::allocator<std::pair<CPropertyPage const * const,TreePropSheet::CTreePropSheetBase::CPageInformation> >,0> >()  Line 527    C++

         fxecgSUD.exe!std::map<CPropertyPage const * const,TreePropSheet::CTreePropSheetBase::CPageInformation,std::less<CPropertyPage const * const>,std::allocator<std::pair<CPropertyPage const * const,TreePropSheet::CTreePropSheetBase::CPageInformation> > >::~map<CPropertyPage const * const,TreePropSheet::CTreePropSheetBase::CPageInformation,std::less<CPropertyPage const * const>,std::allocator<std::pair<CPropertyPage const * const,TreePropSheet::CTreePropSheetBase::CPageInformation> > >()  + 0x16 bytes  C++

         fxecgSUD.exe!TreePropSheet::CTreePropSheetBase::~CTreePropSheetBase()  Line 119 + 0x12 bytes   C++

         fxecgSUD.exe!TreePropSheet::CTreePropSheetEx::~CTreePropSheetEx()  Line 74 + 0x2f bytes    C++

         fxecgSUD.exe!TreePropSheet::CTreePropSheetEx::`scalar deleting destructor'()  + 0x16 bytes       C++

         fxecgSUD.exe!CDlgBarPages::RegisterSheet(unsigned int nID=1001, CDlgBarPageArray * ppages=0x14cafaf8)  Line 128 + 0x29 bytes      C++

         fxecgSUD.exe!CDlgBarPages::ShowPages_internal(CDlgBarPageArray * ppage_arr=0x14cafaf8)  Line 257      C++

         fxecgSUD.exe!CDlgBarPages::ShowPages(CDlgBarPageArray * ppage_arr=0x14cafaf8)  Line 214 + 0xc bytes         C++

         fxecgSUD.exe!CMainFrame::OnECGViewActivate(unsigned int w=0, long __formal=0)  Line 518C++

         fxecgSUD.exe!CWnd::OnWndMsg(unsigned int message=1037, unsigned int wParam=0, long lParam=0, long * pResult=0x0012f564)  Line 2004 + 0x11 bytesC++

         fxecgSUD.exe!CWnd::WindowProc(unsigned int message=1037, unsigned int wParam=0, long lParam=0)  Line 1741 + 0x20 bytes     C++

         fxecgSUD.exe!AfxCallWndProc(CWnd * pWnd=0x00e4a1a8, HWND__ * hWnd=0x00050360, unsigned int nMsg=1037, unsigned int wParam=0, long lParam=0)  Line 240 + 0x1c bytesC++

         fxecgSUD.exe!AfxWndProc(HWND__ * hWnd=0x00050360, unsigned int nMsg=1037, unsigned int wParam=0, long lParam=0)  Line 389         C++

         user32.dll!77d18734()         

         user32.dll!77d18816()         

         fxecgSUD.exe!_AfxMsgFilterHook(int code=1242844, unsigned int wParam=2010383463, long lParam=2010220592)  Line 795        C++

         user32.dll!77d1eaf2()

         user32.dll!77d1b4c0()         

         user32.dll!77d1eaad()

         user32.dll!77d1b50c()         

         ntdll.dll!7c92eae3()    

         user32.dll!77d194be()         

         user32.dll!77d1b42d()         

         user32.dll!77d1b3f9()          

         user32.dll!77d1b393()         

         user32.dll!77d18734()         

         user32.dll!77d18816()         

         user32.dll!77d1c63f()

         user32.dll!77d1c665()         

         fxecgSUD.exe!CWnd::DefWindowProcW(unsigned int nMsg=274, unsigned int wParam=61559, long lParam=26411830)  Line 1029 + 0x20 bytes         C++

         fxecgSUD.exe!CWnd::WindowProc(unsigned int message=274, unsigned int wParam=61559, long lParam=26411830)  Line 1742 + 0x1c bytes         C++

         fxecgSUD.exe!AfxCallWndProc(CWnd * pWnd=0x14cafb20, HWND__ * hWnd=0x000a03d4, unsigned int nMsg=274, unsigned int wParam=61559, long lParam=26411830)  Line 240 + 0x1c bytes      C++

         fxecgSUD.exe!AfxWndProc(HWND__ * hWnd=0x000a03d4, unsigned int nMsg=274, unsigned int wParam=61559, long lParam=26411830)  Line 389   C++

         user32.dll!77d18734()         

         user32.dll!77d18816()         

         user32.dll!77d1b4c0()         

         user32.dll!77d1b50c()         

         ntdll.dll!7c92eae3()    

         user32.dll!77d194be()         

         user32.dll!77d1b42d()         

         user32.dll!77d184fc()

         user32.dll!77d185a4()         

         user32.dll!77d1b3f9()          

         user32.dll!77d1b393()         

         user32.dll!77d18734()         

         user32.dll!77d18816()         

         user32.dll!77d1c63f()

         user32.dll!77d1c665()         

         fxecgSUD.exe!CWnd::DefWindowProcW(unsigned int nMsg=161, unsigned int wParam=7, long lParam=26411830)  Line 1029 + 0x20 bytes         C++

         fxecgSUD.exe!CWnd::WindowProc(unsigned int message=161, unsigned int wParam=7, long lParam=26411830)  Line 1742 + 0x1c bytes   C++

         fxecgSUD.exe!AfxCallWndProc(CWnd * pWnd=0x14cafb20, HWND__ * hWnd=0x000a03d4, unsigned int nMsg=161, unsigned int wParam=7, long lParam=26411830)  Line 240 + 0x1c bytes    C++

         fxecgSUD.exe!AfxWndProc(HWND__ * hWnd=0x000a03d4, unsigned int nMsg=161, unsigned int wParam=7, long lParam=26411830)  Line 389         C++

         user32.dll!77d18734()         

         user32.dll!77d18816()         

         user32.dll!77d189cd()         

         user32.dll!77d18a10()         

         fxecgSUD.exe!AfxInternalPumpMessage()  Line 183       C++

         fxecgSUD.exe!CWinThread::PumpMessage()  Line 896   C++

         fxecgSUD.exe!CWinThread::Run()  Line 625 + 0xd bytes         C++

         fxecgSUD.exe!CWinApp::Run()  Line 889     C++

         fxecgSUD.exe!AfxWinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * hPrevInstance=0x00000000, wchar_t * lpCmdLine=0x00020954, int nCmdShow=1)  Line 47 + 0xd bytes    C++

         fxecgSUD.exe!wWinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * hPrevInstance=0x00000000, wchar_t * lpCmdLine=0x00020954, int nCmdShow=1)  Line 29      C++

         fxecgSUD.exe!__tmainCRTStartup()  Line 315 + 0x35 bytes    C

         fxecgSUD.exe!wWinMainCRTStartup()  Line 187  C

         kernel32.dll!7c816d4f()       

         kernel32.dll!7c8399f3()       

posted on 2006-03-25 12:40 zhaowd2001 阅读(3319) 评论(5)  编辑 收藏 引用

评论

# re: Heap error in Visual Studio 2005 Pro C++  回复  更多评论   

不知道你的问题解决了没有啊?我也遇到了类似的问题。如果你找到原因了,把你的结论写一下吧,谢谢!
2007-07-31 14:43 | scl

# re: Heap error in Visual Studio 2005 Pro C++  回复  更多评论   

能给我发封邮件的话,我就更感激了:Scl1978@21cn.com
2007-07-31 14:45 | scl

# re: Heap error in Visual Studio 2005 Pro C++  回复  更多评论   

具体记不清楚了,大概是保存了一个CWnd* 指针,而此CWnd* 已经被释放的原因。

如果你能把你的代码简化一下,发给我,我倒是愿意给你调试一下。
2007-07-31 15:23 | zhaowd2001@yahoo.com

# re: Heap error in Visual Studio 2005 Pro C++  回复  更多评论   

谢了,刚刚找到原因了。到微软的网站找了一个调试工具,可以帮助发现heap错误。网址如下:http://www.microsoft.com/whdc/devtools/debugging/default.mspx
2007-07-31 17:47 | scl

# re: Heap error in Visual Studio 2005 Pro C++  回复  更多评论   

重启程序
2008-05-04 09:12 | 梁美仪

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理