[ https://issues.apache.org/activemq/browse/AMQCPP-118?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_39190 ]
Albert Strasheim commented on AMQCPP-118: ----------------------------------------- Actually looking at where this crashes turns up something interesting. The stack looks like this: ntdll.dll!7c901230() [Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll] ntdll.dll!7c96c943() ntdll.dll!7c96cd80() ntdll.dll!7c960af8() kernel32.dll!7c85e9cf() vs2005-activemq-example.exe!_CrtIsValidHeapPointer(const void * pUserData=0x00c1af70) Line 2072 C++ vs2005-activemq-example.exe!_free_dbg_nolock(void * pUserData=0x00c1af70, int nBlockUse=1) Line 1279 + 0x9 bytes C++ vs2005-activemq-example.exe!_free_dbg(void * pUserData=0x00c1af70, int nBlockUse=1) Line 1220 + 0xd bytes C++ vs2005-activemq-example.exe!operator delete(void * pUserData=0x00c1af70) Line 54 + 0x10 bytes C++ vs2005-activemq-example.exe!std::allocator<char>::deallocate(char * _Ptr=0x00c1af70, unsigned int __formal=32) Line 141 + 0x9 bytes C++ vs2005-activemq-example.exe!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Tidy(bool _Built=true, unsigned int _Newsize=0) Line 2076 C++ vs2005-activemq-example.exe!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::~basic_string<char,std::char_traits<char>,std::allocator<char> >() Line 906 C++ vs2005-activemq-example.exe!HelloWorldConsumer::onMessage(const cms::Message * message=0x00c1aa58) Line 246 C++ activemq-cppd.dll!activemq::core::ActiveMQConsumer::dispatch(activemq::core::DispatchData & data={...}) Line 432 C++ activemq-cppd.dll!activemq::core::ActiveMQSessionExecutor::dispatch(activemq::core::DispatchData & data={...}) Line 189 C++ activemq-cppd.dll!activemq::core::ActiveMQSessionExecutor::dispatchAll() Line 274 C++ activemq-cppd.dll!activemq::core::ActiveMQSessionExecutor::run() Line 213 C++ activemq-cppd.dll!activemq::concurrent::Thread::runCallback(void * param=0x00c11ad8) Line 152 + 0x13 bytes C++ msvcr80d.dll!_callthreadstartex() Line 348 + 0xf bytes C msvcr80d.dll!_threadstartex(void * ptd=0x00c13088) Line 331 C kernel32.dll!7c80b683() The code that crashes is this: {noformat} if( textMessage != NULL ) { text = textMessage->getText(); } else { text = "NOT A TEXTMESSAGE!"; } {noformat} It crashes where the destructor for text is called, because it's trying to deallocate the string from the wrong heap. This doesn't make complete sense to me yet, but it doesn't look good for the mixing of runtimes. > Provide a way to allocate and free with the same allocator > ---------------------------------------------------------- > > Key: AMQCPP-118 > URL: https://issues.apache.org/activemq/browse/AMQCPP-118 > Project: ActiveMQ C++ Client > Issue Type: Improvement > Reporter: Albert Strasheim > Assignee: Nathan Mittler > Fix For: 2.1 > > > Cross-runtime allocation and deallocation can cause problems on Windows (and > maybe other platforms) where you can have code linked against more than one > runtime in the same program. There should be a way to be sure that you > allocate and deallocate AMQCPP objects using code linked against the same > runtime (i.e. allocate and deallocate from the same heap). > More details in this thread: > [http://www.nabble.com/Licensing-and-Porting-Issue-for-the-CMS-(ActiveMQ-CPP)-on-Visual-Studio-6-from-Visual-Studio-8-t3777279s2354.html] > and here: > http://blogs.msdn.com/oldnewthing/archive/2006/09/15/755966.aspx -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.