Possible memory leak in activemq::transport::IOTransport::run
-------------------------------------------------------------

                 Key: AMQCPP-121
                 URL: https://issues.apache.org/activemq/browse/AMQCPP-121
             Project: ActiveMQ C++ Client
          Issue Type: Bug
    Affects Versions: 2.1
            Reporter: Albert Strasheim
            Assignee: Nathan Mittler
             Fix For: 2.1


There might be a memory leak in activemq::transport::IOTransport::run.

Valgrind says:

==20739== 20 bytes in 1 blocks are definitely lost in loss record 126 of 175
==20739==    at 0x4005BA5: operator new(unsigned) (vg_replace_malloc.c:163)
==20739==    by 0x4776995: 
activemq::connector::openwire::marshal::v2::ResponseMarshaller::createObject() 
const (ResponseMarshaller.cpp:40)
==20739==    by 0x46A433B: 
activemq::connector::openwire::OpenWireFormat::doUnmarshal(activemq::io::DataInputStream*)
 (OpenWireFormat.cpp:239)
==20739==    by 0x46A48C9: 
activemq::connector::openwire::OpenWireFormat::unmarshal(activemq::io::DataInputStream*)
 (OpenWireFormat.cpp:185)
==20739==    by 0x46A6E5D: 
activemq::connector::openwire::OpenWireCommandReader::readCommand() 
(OpenWireCommandReader.cpp:71)
==20739==    by 0x46D3857: activemq::transport::IOTransport::run() 
(IOTransport.cpp:166)
==20739==    by 0x4667DE7: activemq::concurrent::Thread::runCallback(void*) 
(Thread.cpp:152)
==20739==    by 0x4963DA: start_thread (in /lib/libpthread-2.5.so)
==20739==    by 0x3F026D: clone (in /lib/libc-2.5.so)

The code looks like this:

void IOTransport::run(){
    try{
        while( !closed ){
            Command* command = reader->readCommand();
            fire( command );
        }
    }
    catch( exceptions::ActiveMQException& ex ){ /*...*/ }
    catch( ... ){ /*...*/ }
}

What might be happening here is that readCommand succeeds but that fire throws 
an exception for some reason. If this happens, command won't be freed.

Not quite sure under what circumstances this happens. If you're not convinced, 
I can try to narrow down the code that causes the leak.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to