Fons N 17 Posted November 18, 2022 Using Delphi Pro 11.2. The following exception messages occur frequently but not always. The important thing is, they ALWAYS occur when I close the application (the application is started in Delphi in debug mode). Project Recon.exe raised exception class $C0000005 with message 'access violation at 0x073302E8: read of address 0x62C8CA2D'. Project Recon.exe raised exception class $C0000005 with message 'access violation at 0x073302E8: read of address 0x62C8B12B'. Delphi generates a detailed map. Below a very small piece for illustrating purposes. Class 0001:00401000 017BD1B4H .text CODE 0002:01BBF000 0000B8F0H .itext ICODE 0003:01BCB000 0008C850H .data DATA 0004:01C58000 00042708H .bss BSS 0005:00000000 00000058H .tls TLS 0006:00400000 00000000H .pdata PDATA Detailed map of segments 0001:00000000 00010D80 C=CODE S=.text G=(none) M=System ACBP=A9 0001:00010D80 00000C9C C=CODE S=.text G=(none) M=SysInit ACBP=A9 0001:00011A1C 000028F4 C=CODE S=.text G=(none) M=System.Types ACBP=A9 0001:00014310 00000B2C C=CODE S=.text G=(none) M=System.UITypes ACBP=A9 0001:00014E3C 000036F0 C=CODE S=.text G=(none) M=Winapi.Windows ACBP=A9 I searched the values 073302E8, 62C8CA2D and 62C8B12B from the exception messages in the detailed map, but none of them can be found. I was hoping for a clue which component or part of the code the exception was related too. But, alas, no help here. If these exception message occur and right after I start the application again (from Delphi in debug mode) by pressing F9 without modifying anything, then all works fine. The application can be closed without any exception message. Nothing changed, but now it closes fine. In one way this good, but in another way, it is not, because it now seems even more difficult to solve the problem. When this happens, I also start the application by clicking on the executable from the Windows Explorer. I can start, do something, and close the application without getting any error. Does this scenario seem familiar to you..? Might is just be an issue with the Delphi debugger or something? In other words, the exception messages do not directly relate to mine application or code. Any help or insight is appreciated. Share this post Link to post
FPiette 385 Posted November 18, 2022 You said it runs under debug. If so, the IDE should show you the exact line of error if it happen in your code. It also show the call stack. The symtoms you describe makes me thing you have an uninitialized pointer or initialized object reference or use of an initialized local variable. Using a tool such as madExcept could help you find the issue. Share this post Link to post
Der schöne Günther 316 Posted November 18, 2022 5 hours ago, Fons N said: I searched the values 073302E8, 62C8CA2D and 62C8B12B from the exception messages in the detailed map, but none of them can be found. I'm no expert on that, but 0x073302E8 is your instruction address. Can't you just start your application in the debugger (press F8) and then use "Go to address" and see where that ends up? Share this post Link to post
Fons N 17 Posted November 19, 2022 (edited) 19 hours ago, FPiette said: You said it runs under debug. If so, the IDE should show you the exact line of error if it happen in your code. It also show the call stack I hardly ever use that, but you are right. It happened again and this is the call stack. And this is the line the debugger shows: FillChar(PFastMM_DebugBlockHeader(Result).DebugFooter_FreeStackTracePtr^, LStackTraceDepth * SizeOf(Pointer), 0); As already said, it only happens when I close the application. And as far as I can tell, it does not have anything to do with my code. As I only use FasMM_FullDebugMode.dll in debug mode (no pun intended) I just must except this as an inconvenience. BTW, I also installed madExcept but it did not report an exception. That might have to do with the option "enable IDE exception catching" which I did not enable. Not sure, though. Thanks for your help. If you have any other input, again, it is much appreciated. Edited November 19, 2022 by Fons N Share this post Link to post
FPiette 385 Posted November 19, 2022 2 hours ago, Fons N said: FillChar(PFastMM_DebugBlockHeader(Result).DebugFooter_FreeStackTracePtr^, LStackTraceDepth * SizeOf(Pointer), 0); You didn't mentioned in which source code file this happens. Is it yours or in FastMM source code? The last line you show in the call stack tells that the exception occur in one of the finalization section in one of the unit. The first argument passed to FillChar probably point to an invalid memory location (Random or already freed) or the length passed in the second argument overflow the length of the memory block pointed by the first argument. If the line is located in FastMM, it is probably a line that is used by FastMM to detect buffer overflow or underflow. For madExcept, be sure to check "Report resource leaks" and "instantly crash on buffer ... overrun" if "overrun" doesn't give any error, try with "underrun". Share this post Link to post
Fons N 17 Posted November 20, 2022 19 hours ago, FPiette said: You didn't mentioned in which source code file this happens. Is it yours or in FastMM source code? The last line you show in the call stack tells that the exception occur in one of the finalization section in one of the unit. For madExcept, be sure to check "Report resource leaks" and "instantly crash on buffer ... overrun" if "overrun" doesn't give any error, try with "underrun". Sorry, I presumed from the call stack it would be clear that it is from the FastMM source code. My bad. None of my own units have a finalization section. So, it either must be from the Delphi source code, the FastMM source code or from the 3rd party source code. The good thing about it, is that it's not my code that is faulty, but the bad thing about it, is that it's way more problematic to solve (from mine point of view at least). As for the madExcept setting, I will do that. Thanks for the advice. Share this post Link to post