Return-Path: X-Original-To: apmail-qpid-users-archive@www.apache.org Delivered-To: apmail-qpid-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 56EFC7A84 for ; Tue, 4 Oct 2011 11:32:14 +0000 (UTC) Received: (qmail 35608 invoked by uid 500); 4 Oct 2011 11:32:14 -0000 Delivered-To: apmail-qpid-users-archive@qpid.apache.org Received: (qmail 35583 invoked by uid 500); 4 Oct 2011 11:32:14 -0000 Mailing-List: contact users-help@qpid.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@qpid.apache.org Delivered-To: mailing list users@qpid.apache.org Received: (qmail 35575 invoked by uid 99); 4 Oct 2011 11:32:14 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Oct 2011 11:32:14 +0000 X-ASF-Spam-Status: No, hits=2.0 required=5.0 tests=FREEMAIL_FROM,SPF_NEUTRAL,T_FRT_BELOW2,T_TO_NO_BRKTS_FREEMAIL,URI_HEX X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: 216.139.236.26 is neither permitted nor denied by domain of jleahred@gmail.com) Received: from [216.139.236.26] (HELO sam.nabble.com) (216.139.236.26) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Oct 2011 11:32:08 +0000 Received: from jim.nabble.com ([192.168.236.80]) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1RB3Dw-00069a-86 for users@qpid.apache.org; Tue, 04 Oct 2011 04:31:48 -0700 Date: Tue, 4 Oct 2011 04:31:48 -0700 (PDT) From: joseluis To: users@qpid.apache.org Message-ID: <1317727908239-6858408.post@n2.nabble.com> Subject: receptor out of scope with no calling receptor.close(); MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi, With other program, I'm sending 1000 messages per second on exchante testing/PRD1 In program bellow, I'm receiving those messages The receptor gets out of scope and is created a new one per 1000 messages If line receptor.close(); is commented, the client program increase quickly the cpu usage and memory If line receptor.close(); is not commented, it works fine #include <qpid/messaging/Connection.h> #include <qpid/messaging/Message.h> #include <qpid/messaging/Receiver.h> #include <qpid/messaging/Sender.h> #include <qpid/messaging/Session.h> #include using namespace qpid::messaging; int main(int /*argc*/, char** /*argv*/) { std::string broker = "127.0.0.1:5672"; Connection connection(broker, ""); try { connection.open(); Session session = connection.createSession(); std::string address = "testing/PRD1; " "{ " " assert: allways, " //" create: never, " " node : " " { " " type: topic " " }, " " link: " " { " " durable: false, " " x-declare: " " { " " auto-delete: true, " " exclusive: True, " " arguments: " " { " " 'qpid.max_count': 1000, " " 'qpid.max_size': 1000000, " // in bytes " 'qpid.policy_type': ring " " } " " } " " } " "} "; int messages_received=1; while(true) { { // begin receiver scope. Create receiver on reduced scope Receiver receiver = session.createReceiver(address); receiver.setCapacity(100); while(messages_received % 1000 != 0) // every 1000 messages we will destroy and create a new receiver { if(messages_received % 1000) { receiver.fetch(Duration::SECOND*1); ++messages_received; if(messages_received % 100 == 0) std::cout << (messages_received/100)%10 << std::flush; } } receiver.close(); // if commented, the program increase cpu and memory } // end receiver scope, it will create a new receiver instance std::cout << std::endl << "receiver out of scope, creating a new one with same configuration" << std::endl; ++messages_received; } } catch(const std::exception& error) { std::cerr << error.what() << std::endl; connection.close(); return 1; } } kind regards -- View this message in context: http://apache-qpid-users.2158936.n2.nabble.com/receptor-out-of-scope-with-no-calling-receptor-close-tp6858408p6858408.html Sent from the Apache Qpid users mailing list archive at Nabble.com. --------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:users-subscribe@qpid.apache.org