Return-Path: Delivered-To: apmail-activemq-dev-archive@www.apache.org Received: (qmail 56627 invoked from network); 23 Apr 2008 11:24:10 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 23 Apr 2008 11:24:10 -0000 Received: (qmail 78815 invoked by uid 500); 23 Apr 2008 11:24:11 -0000 Delivered-To: apmail-activemq-dev-archive@activemq.apache.org Received: (qmail 78787 invoked by uid 500); 23 Apr 2008 11:24:11 -0000 Mailing-List: contact dev-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list dev@activemq.apache.org Received: (qmail 78776 invoked by uid 99); 23 Apr 2008 11:24:10 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 23 Apr 2008 04:24:10 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 23 Apr 2008 11:23:26 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 710D4234C0F1 for ; Wed, 23 Apr 2008 04:20:43 -0700 (PDT) Message-ID: <246604373.1208949643448.JavaMail.jira@brutus> Date: Wed, 23 Apr 2008 04:20:43 -0700 (PDT) From: "Gregory Mostizky (JIRA)" To: dev@activemq.apache.org Subject: [jira] Created: (AMQ-1681) Memory leak when creating large numbers of TemporaryQueues (Log4J related) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Memory leak when creating large numbers of TemporaryQueues (Log4J related) -------------------------------------------------------------------------- Key: AMQ-1681 URL: https://issues.apache.org/activemq/browse/AMQ-1681 Project: ActiveMQ Issue Type: Bug Components: Broker Affects Versions: 5.0.0 Environment: Embedded broker using Log4J Reporter: Gregory Mostizky When using an embedded broker and using Log4J, there is a memory leak in the broker for each new TemporaryQueue created. This seems to be the offending code (taken from 5.0.0-release source): org.apache.activemq.broker.region.Queue: public Queue(Broker broker, ActiveMQDestination destination, final SystemUsage systemUsage, MessageStore store, DestinationStatistics parentStats, TaskRunnerFactory taskFactory, Store tmpStore) throws Exception { ... skipped.... // let's copy the enabled property from the parent DestinationStatistics this.destinationStatistics.setEnabled(parentStats.isEnabled()); destinationStatistics.setParent(parentStats); this.log = LogFactory.getLog(getClass().getName() + "." + destination.getPhysicalName()); } What happens here is that for each new TemporaryQueue created a new log instance is created with rather large string as it's name. This instance is unique for each new TemoraryQueue and because of the way Log4J handles those instances, it is never removed once initalized. We hit this bug when we were testing performance together with Spring-based synchronous JMS API, which is implemented in such a way that for each new message it creates a new TemporaryQueue. We got OutOfMemory after about 40000 messages with 128M heap. I am not sure what this special log instance is used for, but assuming it's not very important, it will be easy to fix this bug with just using some predefined log name always. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.