Invalid allocation size...
-
... kommt, wenn ich die .exe im Debug (auch im Release) versuche zu öffnen. Im VS funzt alles (F5 & STRG+F5). Hab leider bis jetzt wenig Ahnung von MFC und Windowsprogramme, aber vielleicht kann einer von Euch ja weiterhelfen

achja, sehr seltsam ist die riesen Zahl: Invalid allocation size: 4294967268 bytes (entspricht über 4000gb!) Die erzeugte .exe selber hat nur 250kb.
-
Allkoierst Du beim Starten im Programm irgendwo speicher ?
-
sicher, aber bei weitem nicht so viel. Sind ein paar matrizen, instanziere ein paar objekte die z.T. auch dynamischen Speicher haben. Möglich das der Fehler von einem Memoryleak kommt?
-
sieht nach einer allokation mit negativer Länge aus (integer-Überlauf).
"Verdächtige" Allokationen testen und/oder mit dem Debugger rantasten.
-
wie soll das mit dem Debugger gehen? Denn beim Debuggen geht alles! Nur wenn ich die exe Starte.
Hab die exe (beide Versionen, die im Debugordner und die im Release ordner )jetzt mal mit Purify von Rational versucht zu analysieren. Hab leider nicht viel Ahnung von dem Tool - scheint aber ganz hilfreich zu sein. Hab nur Probleme die Ergebnisse zu analysieren:
[I] Starting Purify'd GRAF1.exe at 22.11.2003 08:57:34 [I] Starting main [E] FMM: Freeing mismatched memory in delete(void *) {5 occurrences} Address 0x0036b438 points into a malloc'd block in heap 0x00360000 Location of free attempt delete(void *) [dbgdel.cpp:37] !>(void *) [delete2.cpp:21] CView::OnPaint(void) [viewcore.cpp:182] CWnd::OnWndMsg(UINT,UINT,long,long *) [wincore.cpp:2014] CWnd::WindowProc(UINT,UINT,long) [wincore.cpp:1737] AfxCallWndProc(CWnd *,HWND__ *,UINT,UINT,long) [wincore.cpp:241] AfxWndProc(HWND__ *,UINT,UINT,long) [wincore.cpp:386] AfxWndProcBase(HWND__ *,UINT,UINT,long) [afxstate.cpp:209] GetLastInputInfo [USER32.dll] AfxInternalPumpMessage(void) [thrdcore.cpp:186] Allocation location malloc [dbgheap.c:138] CView::OnPaint(void) [viewcore.cpp:182] CWnd::OnWndMsg(UINT,UINT,long,long *) [wincore.cpp:2014] CWnd::WindowProc(UINT,UINT,long) [wincore.cpp:1737] AfxCallWndProc(CWnd *,HWND__ *,UINT,UINT,long) [wincore.cpp:241] AfxWndProc(HWND__ *,UINT,UINT,long) [wincore.cpp:386] AfxWndProcBase(HWND__ *,UINT,UINT,long) [afxstate.cpp:209] GetLastInputInfo [USER32.dll] AfxInternalPumpMessage(void) [thrdcore.cpp:186] CWinThread::PumpMessage(void) [thrdcore.cpp:915] [E] FMM: Freeing mismatched memory in delete(void *) {12 occurrences} [I] MAF: Memory allocation failure of 4294967268 bytes in malloc {1 occurrence} Allocation location malloc [dbgheap.c:138] _CRTIMP void * __cdecl malloc ( size_t nSize ) => { void *res = _nh_malloc_dbg(nSize, _newmode, _NORMAL_BLOCK, NULL, 0); RTCCALLBACK(_RTC_Allocate_hook, (res, nSize, 0)); CView::OnPaint(void) [viewcore.cpp:182] CWnd::OnWndMsg(UINT,UINT,long,long *) [wincore.cpp:2014] CWnd::WindowProc(UINT,UINT,long) [wincore.cpp:1737] AfxCallWndProc(CWnd *,HWND__ *,UINT,UINT,long) [wincore.cpp:241] AfxWndProc(HWND__ *,UINT,UINT,long) [wincore.cpp:386] AfxWndProcBase(HWND__ *,UINT,UINT,long) [afxstate.cpp:209] GetLastInputInfo [USER32.dll] AfxInternalPumpMessage(void) [thrdcore.cpp:186] CWinThread::PumpMessage(void) [thrdcore.cpp:915] [I] EXI: Ignored exception in std::_Nomemory(void) {1 occurrence} [I] Summary of all memory in use... {41797 bytes, 238 blocks} [I] Summary of all memory leaks... {35123 bytes, 27 blocks} [I] Message: Assertion failed: pHead->nBlockUse == nBlockUse [E] IPR: Invalid pointer read in CWinApp::~CWinApp(void) {1 occurrence} Reading 1 byte from 0x00159bf4 (1 byte at 0x00159bf4 illegal) Address 0x00159bf4 points into a HeapAlloc'd block in unallocated region of the default heap Thread ID: 0xe34 Error location CWinApp::~CWinApp(void) [appcore.cpp:574] doexit [crt0dat.c:365] * call thru it. */ if ( *__onexitend != NULL ) => (**__onexitend)(); } /* cexit [crt0dat.c:309] void ) { => doexit(0, 0, 1); /* full term, return to caller */ } void __cdecl _c_exit ( CRTDLL_INIT [crtlib.c:301] */ if ( _C_Termination_Done == FALSE ) => _cexit(); #ifdef _DEBUG /* Dump all memory leaks */ GetTimeZoneInformation [kernel32.dll] CreateToolhelp32Snapshot [kernel32.dll] XcptFilter [winxfltr.c:228] /* * pass the buck to the UnhandledExceptionFilter */ => return( UnhandledExceptionFilter(pxcptinfoptrs) ); /* except_handler3 [exsup3.obj] ActivateActCtx [kernel32.dll] CxxThrowException [throw.obj] [E] IPR: Invalid pointer read in CWinApp::~CWinApp(void) {1 occurrence} [E] IPR: Invalid pointer read in CWinApp::~CWinApp(void) {1 occurrence} [E] IPR: Invalid pointer read in CThreadLocalObject::GetData((*)(void)) {1 occurrence} [E] IPR: Invalid pointer read in CThreadLocalObject::GetData((*)(void)) {1 occurrence} [E] IPR: Invalid pointer read in CThreadSlotData::GetThreadValue(int) {1 occurrence} [I] Summary of all handles in use... {13 occurrences} [I] Exiting with code 3 (0x00000003) [I] Program terminated at 22.11.2003 08:57:44übrigends stürzt das Programm ab

Was auch noch seeehr seltsam ist - erstelle ich eine kleine "hallo-welt" konsolenanwendung, dann liefert Purify folgendes:[I] Starting Purify'd test2.exe at 22.11.2003 14:29:46 [I] Starting main [I] Summary of all memory leaks... {5901 bytes, 53 blocks} [W] MLK: Memory leak of 5901 bytes from 53 blocks allocated in HeapAlloc [KERNEL32.dll] Distribution of leaked blocks Allocation location HeapAlloc [KERNEL32.dll] [I] Exiting with code 0 (0x00000000) [I] Program terminated at 22.11.2003 14:29:48liegt das jetzt am Compiler & XP?
-
Stell sicher das die Variable die beim Allokieren verwendet wird Initialisiert wurde. Wenn Du diesen WErt berechnest prüfe alle Variablen ab die dort beteiligt sind.
-
update:
ich honk hab vergessen, die nötigen files mit in den Release bzw Debug ordner zu kopieren - die Pfadangaben im Programm waren nämlich relativ. Also der Absturz ist behoben.
Dennoch hagelt es FMM Fehler - leider zeigt das Tool nicht die Zeile im Code an, die daran schuld ist - oder geht das vielleicht doch??
-
hab den Fehler: musste ein Objekt erstmal mit dem leeren Konstruktor instanziieren. Jetzt sind nur noch ein paar Leaks da - wie krieg ich beim Beenden den Speicher sauber? (der Debugger zeigt beim Beenden noch Leaks bei warning level 4 an) in der Methode CMainFrame::OnClose() hab ich kein Zugang zu den restlichen Objekten und kann die deshalb auch nicht löschen - auch extern geht seltsamer weise nicht. Gibts vielleicht eine Funktion die brutal alles wegschmeisst, dass vorher in den Speicher geschaufelt wurde?