You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Nathan Mittler (JIRA)" <ji...@apache.org> on 2007/04/23 16:19:34 UTC
[jira] Closed: (AMQCPP-68) Memory Leak in Message transport / send
/ recieve C++ client
[ https://issues.apache.org/activemq/browse/AMQCPP-68?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Nathan Mittler closed AMQCPP-68.
--------------------------------
Resolution: Won't Fix
We are only going to be supporting the activemq-cpp client
> Memory Leak in Message transport / send / recieve C++ client
> ------------------------------------------------------------
>
> Key: AMQCPP-68
> URL: https://issues.apache.org/activemq/browse/AMQCPP-68
> Project: ActiveMQ C++ Client
> Issue Type: Bug
> Components: Other C++ Clients
> Environment: Win XP, VC++ Version 8
> Reporter: Tomas Lebovic
> Priority: Critical
>
> There seems to be a memory leak in the message transport. If we take the following simple code below and then monitor memory consumption we will see it steadily go up.
> <code>
> #include <exception>
> #include <iostream>
> #include <map>
> #include <string>
> #include <stdio.h>
> #include <cms/IConnection.hpp>
> #include <cms/IConnectionFactory.hpp>
> #include <activemq/ConnectionFactory.hpp>
> #include <activemq/Connection.hpp>
> #include <ppr/TraceException.hpp>
> #include <ppr/net/Uri.hpp>
> #include <ppr/util/ifr/p>
> using namespace apache::activemq;
> using namespace apache::ppr::net;
> class TestAsynchTopic :public IMessageListener
> {
> private:
> public:
> void onMessage(p<IMessage> message)
> {
> p<IMapMessage> msg = p_dyncast<IMapMessage> (message) ;
> printf("got %s\n",msg->getString("msg")->c_str());
> msg = NULL;
> }
> } ;
> char * bunk = "memory leak?";
> int main()
> {
> TestAsynchTopic list1;
>
> p<Uri> uri = new Uri("tcp://localhost:61616");
> p<ConnectionFactory> factory = new ConnectionFactory(uri);
> p<ISession> session = NULL;
> p<ITopic> topic = NULL ;
> p<IMessageConsumer> consumer1 = NULL;
> p<IMapMessage> message = NULL ;
> p<IMessageProducer> producer = NULL ;
> try
> {
> p<IConnection> connection = factory->createConnection();
> session= connection->createSession();
> }
> catch(ConnectionException &e)
> {
> printf("%s\n",e.what());
> }
>
> topic = session->getTopic("memory.leak") ;
> producer = session->createProducer(topic) ;
> consumer1 = session->createConsumer(topic) ;
> consumer1->setMessageListener( smartify(&list1) ) ;
> while(1)
> {
> message = session->createMapMessage();
> message->setString("msg", (char*)bunk);
> producer->send(message);
> message = NULL;
> }
> return 0;
> }
> </code>
> Now i haven't been using c++ api for a long time but i can't see any way to destroy the messages other then letting them go out of scope or when refrence count = 0. So if there is a way to destroy the messages after they are sent / recieved please let me know.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.