Programming C++Builder Access violation at address 40A29D24. Read of address 00CB88C4 in C++Builder/Delphi programs

Project XXX.exe raised exception class EAccessViolation with message 'Access violation at address 40A29D24. Read of address 00CB88C4'. Process stopped. Use Step or Run to continue. When you debug your codes, you receive such an error prompt.

About an error raise "Access violation at address 40A29D24. Read of address 00CB88C4" in delphi or C++Builder. This is a typical error message raise by the system when you running your program. It means that your program has some problem you have not well handled.

This is always caused by an Illegal access to the memory. Like when you declare an object, but not allocate it in memory, then you access it, the error will raise. Let us take an example:

/*line 1*/        TStringList *pStrList;
/*line 2*/        pStrList->Add("my string one");        //This line will raise an error of "access vialotion at address xxxxxxxx".

The correct codes should be:
/*line 1*/        TStringList *pStrList;
/*line 2*/        pStrList = new TStringList;
/*line 3*/        pStrList->Add("my string one"); 
....................Some Codes Here......................
/*line n*/        delete pStrList;

Sometimes you have check your program many times and found no problems while it still raise such an error, why? I think this mainly caused by the bug of delphi or c++builder's enviroment. You could go the borland's home page to get the latest patch and update your delphi or c++builder.

After you patch your enviroment or there is no patch available while the error still be there. Well, you could check your programs if you have use a TClientDataSet component or you are just programming relative to the database. Try to proper to open the connection and remember to close it before quit the program. This is always effect to avoid the error.

Sometimes you have check your code carefully while still found no error, which can mean an advance error, check out here to use the CodeGuard to debug Project app.exe faulted with message: 'access violation at 0x40036887: read of address 0x00000010'. Process Stopped. Use Step or Run to continue .

And you may get interesting in the following error messages:
Exception class EInvalidCast with message 'Invalid class typecast' in Delphi/C++Builder programs .
Error loading type library/DLL. in delphi programs .
Error loading type library/DLL. in C++Builder Midas App .
project testjpg.exe raised exception class EJPEG with message 'JPEG error # 52' .
Error 823: I/O error on attaching DataBase in Microsoft Sql Server .

Thank you for reading the article, codes here, welcome back!(codeback) And Good Luck!

Add comment

Security code

Programming - C++Builder