Was sagt mir diese Fehlermeldung?



  • ---------------------------
    Microsoft Visual C++ Debug Library
    ---------------------------
    Debug Error!

    Program: D:\Realisierung\Audiodatic_III\Debug\Audiodatic_III.exe

    DAMAGE: after Ignore block (#0) at 0x00432B50.

    (Press Retry to debug the application)
    ---------------------------
    Abbrechen Wiederholen Ignorieren
    ---------------------------

    Diese Meldung habe ich eben bekommen. Ich habe wirklich keine Ahnung, nach was ich nun suchen muss. 😞

    --------------------

    Achja: Hier lande ich:

    if (!CheckBytes(pbData(pHead) + pHead->nDataSize, _bNoMansLandFill, nNoMansLandSize))
                    _RPT3(_CRT_ERROR, "DAMAGE: after %hs block (#%d) at 0x%08X.\n",
                        szBlockUseName[_BLOCK_TYPE(pHead->nBlockUse)],
                        pHead->lRequest,
                        (BYTE *) pbData(pHead));
    

    Das ist die Datei: vc98\crt\src\dbgheap.c Zeile 1034

    --------------------

    Habe weitergeforscht: Kurz bevor er in die Bresche springt, werden 24kb Speicher reserviert.

    Ansonsten springt die Speichernutzung eigentlich nur um etwa 4kb.

    --------------------

    Es gibt noch andere Stellen, wo er beim Absturtz landet:

    void* CMapPtrToPtr::GetValueAt(void* key) const
    // find value (or return NULL -- NULL values not different as a result)
    {
    	if (m_pHashTable == NULL)
    		return NULL;
    
    	UINT nHash = HashKey(key) % m_nHashTableSize;
    
    	// see if it exists
    	CAssoc* pAssoc;
    	for (pAssoc = m_pHashTable[nHash]; pAssoc != NULL; pAssoc = pAssoc->pNext)
    	{
    		if (pAssoc->key == key)
    			return pAssoc->value;
    	}
    	return NULL;
    }
    


  • MSDN:

    The “NoMansLand” buffers on either side of the user data area of the block are currently 4 bytes in size, and are filled with a known byte value used by the debug heap routines to verify that the limits of the user’s memory block have not been overwritten.

    Scheinbar wird da zugeordneter Heap-Speicher überschrieben. Da würde ich mal mit dem Debugger die Aufrufliste abklappern.



  • Davon ist aber nix von mir geschrieben. 😞

    _free_dbg_lk(void * 0x00433be0, int 4) line 1033 + 60 bytes
    _free_dbg(void * 0x00433be0, int 4) line 970 + 13 bytes
    CObject::operator delete(void * 0x00433be0) line 46 + 12 bytes
    CTempDC::`scalar deleting destructor'(unsigned int 1) + 34 bytes
    CHandleMap::DeleteTemp() line 236 + 31 bytes
    AfxUnlockTempMaps(int 1) line 51
    CWinThread::OnIdle(long 1) line 587
    CWinApp::OnIdle(long 1) line 492 + 12 bytes
    CWinThread::Run() line 472 + 30 bytes
    CWinApp::Run() line 400
    AfxWinMain(HINSTANCE__ * 0x00400000, HINSTANCE__ * 0x00000000, char * 0x00132b91, int 1) line 49 + 11 bytes
    WinMain(HINSTANCE__ * 0x00400000, HINSTANCE__ * 0x00000000, char * 0x00132b91, int 1) line 30
    WinMainCRTStartup() line 330 + 54 bytes
    KERNEL32! 77e987e7()
    

    Ich blick es nicht mehr. Ich kann den Fehler in 99% der Fälle reproduzieren, aber es knallt immer mal wieder woanders (andere Quelltextstelle) und nach unterschiedlichen Aktionen.

    Wenn jemand Interesse hat, verschicke ich auch die Klassen, die den Mist machen. Die sind eine Mischung aus mehreren Codeprojekt Klassen: CSortListCtrl und CFilterListCrtl. Vielleicht habe ich da ja was falsch gemacht, obwohl ich nun so aufgepasst habe. 😞

    Im Moment habe ich diese beiden Zeilen im Verdacht, aber ich suche noch nach den Gegenstücken...

    m_pEdit=new CFilterEdit();
    
    			m_pEdit->CreateEx(WS_EX_CLIENTEDGE | WS_EX_NOPARENTNOTIFY ,"EDIT",NULL,ES_WANTRETURN | WS_VISIBLE | WS_CHILD | WS_GROUP | ES_AUTOHSCROLL,rc,this,IDC_ED_EDIT,NULL);
    

    Also, falls noch jemand eine Idee hat... 😞



  • So, dieses Mal hat es bis zum Absturz echt lange gedauert und ich bin hier gelandet:

    CObject* CHandleMap::FromHandle(HANDLE h)
    {
    	ASSERT(m_pClass != NULL);
    	ASSERT(m_nHandles == 1 || m_nHandles == 2);
    
    	if (h == NULL)
    		return NULL;
    
    	CObject* pObject = LookupPermanent(h);
    	if (pObject != NULL)
    		return pObject;   // return permanent one
    	else if ((pObject = LookupTemporary(h)) != NULL)
    	{
    		HANDLE* ph = (HANDLE*)((BYTE*)pObject + m_nOffset); // <--------- HIER
    
    		ASSERT(ph[0] == h || ph[0] == NULL);		
                      ph[0] = h;
    		if (m_nHandles == 2)
    		{
    			ASSERT(ph[1] == h || ph[1] == NULL);
    			ph[1] = h;
    		}
    		return pObject;   // return current temporary one
    	}
    

    Vor allem hab ich jetzt auch Sachen, die ich kenne in der Aufrufliste:

    CHandleMap::FromHandle(void * 0x03010599) line 127 + 3 bytes
    CDC::FromHandle(HDC__ * 0x03010599) line 102 + 12 bytes
    CWnd::GetDC() line 112 + 69 bytes
    CSortHeaderCtrl::CalcFontHeight() line 522 + 8 bytes
    CSortHeaderCtrl::DefWindowProcA(unsigned int 4613, unsigned int 0, long 1243868) line 645
    CWnd::WindowProc(unsigned int 4613, unsigned int 0, long 1243868) line 1586 + 26 bytes
    AfxCallWndProc(CWnd * 0x004328d4 {CSortHeaderCtrl hWnd=???}, HWND__ * 0x000708d8, unsigned int 4613, unsigned int 0, long 1243868) line 215 + 26 bytes
    AfxWndProc(HWND__ * 0x000708d8, unsigned int 4613, unsigned int 0, long 1243868) line 368
    AfxWndProcBase(HWND__ * 0x000708d8, unsigned int 4613, unsigned int 0, long 1243868) line 220 + 21 bytes
    USER32! 77e2a2d0()
    

    (CSortHeaderCtrl ist die Klasse, die ich kenne.)

    Ich habe wohl irgendein Problem mit dem GetDC(). 😕



  • Nächste Version!

    Ich sammel das hier mal, vielleicht sieht ja jemand mal was.

    CDumpContext::operator<<(const char * 0x5f4abadc `string') line 72 + 6 bytes
    CObject::Dump(CDumpContext & {...}) line 118 + 40 bytes
    CSortHeaderCtrl::CalcFontHeight() line 547 + 17 bytes
    CSortHeaderCtrl::DefWindowProcA(unsigned int 4613, unsigned int 0, long 1221276) line 645
    CWnd::WindowProc(unsigned int 4613, unsigned int 0, long 1221276) line 1586 + 26 bytes
    AfxCallWndProc(CWnd * 0x004328d4 {CSortHeaderCtrl hWnd=???}, HWND__ * 0x000a0830, unsigned int 4613, unsigned int 0, long 1221276) line 215 + 26 bytes
    AfxWndProc(HWND__ * 0x000a0830, unsigned int 4613, unsigned int 0, long 1221276) line 368
    AfxWndProcBase(HWND__ * 0x000a0830, unsigned int 4613, unsigned int 0, long 1221276) line 220 + 21 bytes
    
    CDumpContext& CDumpContext::operator<<(LPCTSTR lpsz)
    {
    	if (lpsz == NULL)
    	{
    		OutputString(_T("(NULL)"));
    		return *this;
    	}
    
    #ifdef _DEBUG // all CDumpContext output is controlled by afxTraceEnabled
    	if (!afxTraceEnabled)
    		return *this;
    #endif //_DEBUG
    
    	if (m_pFile == NULL) // Hier steht der Pfeil, war wohl der einen höher?
    	{
    		TCHAR szBuffer[512];
    		LPTSTR lpBuf = szBuffer;
    		while (*lpsz != '\0')
    		{
    

    Und der Memory check error kommt auch gerne.

    memory check error at 0x00436FF0 = 0x01, should be 0xFD.
    memory check error at 0x00436FF1 = 0x00, should be 0xFD.
    memory check error at 0x00436FF2 = 0x00, should be 0xFD.
    memory check error at 0x00436FF3 = 0x00, should be 0xFD.
    Nicht abgefangene Ausnahme in Audiodatic_III.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.
    Nicht abgefangene Ausnahme in Audiodatic_III.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.
    Nicht abgefangene Ausnahme in Audiodatic_III.exe (MFC42D.DLL): 0xC0000005: Access Violation.
    

    Und wie finde ich das, was diese Zeile verursacht?

    Nicht abgefangene Ausnahme in Audiodatic_III.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.
    

    Die kommt nämlich viel öfter als sonst.



  • Einen hab ich noch... 😉 😞

    _free_dbg_lk(void * 0x00434110, int 1) line 1062 + 11 bytes
    _free_dbg(void * 0x00434110, int 1) line 970 + 13 bytes
    operator delete(void * 0x00434110) line 351 + 12 bytes
    CSortListCtrl::FreeItemMemory(const int 17) line 213 + 21 bytes
    CSortListCtrl::DeleteAllItems() line 232 + 12 bytes
    COrteView::LeereListe() line 218
    COrteDoc::Filter(CString {""}, CString {""}) line 125
    COrteView::OnNotify(unsigned int 395450, long 1241428, long * 0x0012ef00) line 458
    CWnd::OnWndMsg(unsigned int 78, unsigned int 395450, long 1241428, long * 0x0012ef44) line 1609 + 40 bytes
    CWnd::WindowProc(unsigned int 78, unsigned int 395450, long 1241428) line 1585 + 30 bytes
    AfxCallWndProc(CWnd * 0x00432790 {COrteView hWnd=???}, HWND__ * 0x000708d0, unsigned int 78, unsigned int 395450, long 1241428) line 215 + 26 bytes
    AfxWndProc(HWND__ * 0x000708d0, unsigned int 78, unsigned int 395450, long 1241428) line 368
    AfxWndProcBase(HWND__ * 0x000708d0, unsigned int 78, unsigned int 395450, long 1241428) line 220 + 21 bytes
    
    /* optionally reclaim memory */
            if (!(_crtDbgFlag & _CRTDBG_DELAY_FREE_MEM_DF))
            {
                /* remove from the linked list */
                if (pHead->pBlockHeaderNext)
                {
    // Zu pHead->pBlockHeaderNext sagt die Überwachung nur: CXX0025
                    pHead->pBlockHeaderNext->pBlockHeaderPrev = pHead->pBlockHeaderPrev; // <-- Hier ist der Pfeil
                }
                else
                {
                    _ASSERTE(_pLastBlock == pHead);
                    _pLastBlock = pHead->pBlockHeaderPrev;
                }
    

    Hier ist noch der Teil aus der Controlklasse:

    void CSortListCtrl::FreeItemMemory( const int iItem )
    {
    	ItemData* pid = reinterpret_cast<ItemData*>( CListCtrl::GetItemData( iItem ) );
    
    	LPTSTR* arrpsz = pid->arrpsz;
    
    	for( int i = 0; i < m_iNumColumns; i++ )
    		delete[] arrpsz[ i ]; // <-----
    
    	delete[] arrpsz;
    	delete pid;
    
    	VERIFY( CListCtrl::SetItemData( iItem, NULL ) );
    }
    BOOL CSortListCtrl::DeleteAllItems()
    {
    	for( int iItem = 0; iItem < GetItemCount(); iItem ++ )
    		FreeItemMemory( iItem ); // <----
    
    	return CListCtrl::DeleteAllItems();
    }
    

Anmelden zum Antworten