I have been seeing an intermittent heap corruption in my AMQ-cpp program, on and of, for some time now. It happens right at the start when it calls activemq::library::ActiveMQCPP::initializeLibrary(). Unfortunately, that which was intermittent is now happening every time.
I am using AMQ-cpp 3.1.0 in Windows-XP SP3, with VS 2005 (aka vc8). By moving this call to at the very start of main, the bug relocates -- it then fails on this line of code: std::auto_ptr<activemq::core::ActiveMQConnectionFactory> connectionFactory( new activemq::core::ActiveMQConnectionFactory(queueManagerName)); The variable 'queueManagerName' is initialised correctly, it is set to"tcp://127.0.0.1:61616". Output from VS is not very helpful: First-chance exception at 0x7c919084 in myprog.exe: 0xC0000005: Access violation reading location 0x0000000f. First-chance exception at 0x7c812afb in myprog.exe: Microsoft C++ exception: std::bad_alloc at memory location 0x0012ee7c.. HEAP[myprog.exe]: Heap block at 0541A820 modified at 0541A864 past requested size of 3c I have tried using DUMA, a memory debugger, to shed any light but unfortunately, it yields nothing. Sadly, I do not have access to purify. Also the code is non-portable (don't ask) so I can't build it on linux and use valgrind. The call stack looks like this: ntdll.dll!7c90120e() [Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll] ntdll.dll!7c96e139() ntdll.dll!7c95f38c() ntdll.dll!7c96e507() ntdll.dll!7c9622e8() ntdll.dll!7c90327a() kernel32.dll!7c85f9a7() > msvcr80d.dll!_CrtIsValidHeapPointer(const void * pUserData=0x0541a848) Line 2072 C++ msvcr80d.dll!_free_dbg_nolock(void * pUserData=0x0541a848, int nBlockUse=1) Line 1279 + 0x9 bytes C++ msvcr80d.dll!_free_dbg(void * pUserData=0x0541a848, int nBlockUse=1) Line 1220 + 0xd bytes C++ msvcr80d.dll!operator delete(void * pUserData=0x0541a848) Line 54 + 0x10 bytes C++ myprog.exe!xms::ConnectionFactory::setProperty() + 0x78e bytes C++ myprog.exe!main(int argc=11, char * * argv=0x054172b0) Line 457 + 0x10 bytes C++ myprog.exe!__tmainCRTStartup() Line 597 + 0x19 bytes C myprog.exe!mainCRTStartup() Line 414 C kernel32.dll!7c817077() This is weird because I do not call ConnectionFactory::setProperty(), and the only call I make to AMQ-cpp from main is the init call. The problem does not occur in Release mode. Unfortunately I need Debug mode (for various reasons). Recently a bug was reported in AMQ-cpp to do with deadlocks that bites Windows users. I am on the version that has that bug but I do not think that bug is responsible for this. I am desperately in need of some help/guidance please. Regards, Andrew Marlow ___________________________________________________________ This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is prohibited. Please refer to http://www.bnpparibas.co.uk/en/information/legal_information.asp?Code=ECAS-845C5H for additional disclosures.