PDA

View Full Version : Invalid Address specified to RtlFreeHeap( 003E0000, 0022FE1C )



falconium
23rd April 2011, 04:23
There is a segmentation fault error when I close the program. It looks like it fails at the point when destructor of main class calls delete ui;.
It doesn't really give more info which ui element could already be deleted, so what can you advise for troubleshooting in such case?

I'm using the latest, 4.7.3 version.


warning: HEAP[NESA.exe]:
warning: Invalid Address specified to RtlFreeHeap( 003E0000, 0022FE1C )


Program received signal SIGTRAP, Trace/breakpoint trap.
0x7c90120f in ntdll!DbgUiConnectToDbg () from C:\WINDOWS\system32\ntdll.dll
(gdb) backtrace
#0 0x7c90120f in ntdll!DbgUiConnectToDbg () from C:\WINDOWS\system32\ntdll.dll
#1 0x7c96ee31 in ntdll!RtlpNtMakeTemporaryKey () from C:\WINDOWS\system32\ntdll.dll
#2 0x7c96f26e in ntdll!RtlpNtMakeTemporaryKey () from C:\WINDOWS\system32\ntdll.dll
#3 0x7c970456 in ntdll!RtlpNtMakeTemporaryKey () from C:\WINDOWS\system32\ntdll.dll
#4 0x7c94bafc in ntdll!LdrFindEntryForAddress () from C:\WINDOWS\system32\ntdll.dll
#5 0x003e0000 in ?? ()
#6 0x7c91a1ba in ntdll!RtlpUnWaitCriticalSection () from C:\WINDOWS\system32\ntdll.dll
#7 0x77c2c2de in msvcrt!free () from C:\WINDOWS\system32\msvcrt.dll
#8 0x003e0000 in ?? ()
#9 0x6a2c1768 in ZN7QObject5eventEP6QEvent () from c:\Qt\Desktop\Qt\4.7.3\mingw\bin\QtCore4.dll
#10 0x6515961e in ZN7QWidget5eventEP6QEvent () from c:\Qt\Desktop\Qt\4.7.3\mingw\bin\QtGui4.dll
#11 0x654ab1c8 in ZN11QMainWindow5eventEP6QEvent () from c:\Qt\Desktop\Qt\4.7.3\mingw\bin\QtGui4.dll
#12 0x6510fa38 in ZN19QApplicationPrivate13notify_helperEP7QObjectP6 QEvent ()
from c:\Qt\Desktop\Qt\4.7.3\mingw\bin\QtGui4.dll
#13 0x65118382 in ZN12QApplication6notifyEP7QObjectP6QEvent () from c:\Qt\Desktop\Qt\4.7.3\mingw\bin\QtGui4.dll
#14 0x6a2b419c in ZN16QCoreApplication14notifyInternalEP7QObjectP6QE vent ()
from c:\Qt\Desktop\Qt\4.7.3\mingw\bin\QtCore4.dll
#15 0x6a2b6f8c in ZN23QCoreApplicationPrivate16sendPostedEventsEP7QO bjectiP11QThreadData ()
from c:\Qt\Desktop\Qt\4.7.3\mingw\bin\QtCore4.dll
#16 0x6a2d6cee in ZN21QEventDispatcherWin3221registerEventNotifierEP 17QWinEventNotifier ()
from c:\Qt\Desktop\Qt\4.7.3\mingw\bin\QtCore4.dll
#17 0x7e418734 in USER32!GetDC () from C:\WINDOWS\system32\user32.dll
#18 0x00000000 in ?? ()

Added after 18 minutes:

OK, I have started to comment out some new parts of the code, and it looks like I have accidentally called setAttribute(Qt::WA_DeleteOnClose, true); for my main class. So I started to find the reason of it with google and found out that the class should be created on the heap instead of stack. I thought that it could mean that I should have had to create an object of the class in main.cpp instead of declaring it as a fix variable, so I was going to try that. Voila! It worked (and of course, removing setAttribute(Qt::WA_DeleteOnClose, true); also works the vice-versa way).

I leave this thread here for future newbies :).

falconium
4th May 2011, 05:04
I again have the similar problem, but it has a different manner.
If I run the release version of the program, then everything is fine, but it crashes in debug mode when i quit the application.
It happened after rebuilding the code. My only guess is that the path is net set for the right DLLs.
Any guess, idea?

Thanks!

falconium
5th May 2011, 00:29
Update: the app crashes randomly. I don't know what could the problem be.
Please, help! I have always reached the end of a complex app, and now it crashes... I don't have anything in my hand to overcome this. I have tried to find memory handling issues with external debugger and leak finder, but it only found those in ui_*.h which are Qt generated. Please, help!

This is what I get all the time:

Dump of assembler code for function ntdll!DbgUiConnectToDbg:
0x7c90120e <+0>: int3
0x7c90120f <+1>: ret
0x7c901210 <+2>: mov %edi,%edi
End of assembler dump.

Added after 34 minutes:

It looks like anytime I free memory up with 'delete', it crashes. However, those were working before...
Could it be that the size of occupied space changed somehow meanwhile? Can it be caused by some release/debug dll mixings? If yes, how should I setup it correctly?

falconium
5th May 2011, 03:02
It seems so that debug_new.cpp/h tool for searching for memory leakage is not really working under Qt. Sad. After removing it from the project, it runs smoothly.
Do you have any better idea for tools which are available for free?