Hi, We're using ActiveMQ 4.1.0. We have code that periodically calls ActiveMQConnectionFactory.createConnection() to try to reestablish a connection when a broker fails. After some time, we were getting a heap overflow if the broker does not come up.
We narrowed down the problem and can replicate it with the following code: import org.apache.activemq.ActiveMQConnectionFactory; import javax.jms.Connection; import javax.jms.JMSException; public class TestJMS { private ActiveMQConnectionFactory connectionFactory; public static void main(String[] args) throws InterruptedException { TestJMS testJMS = new TestJMS(); testJMS.start(); } private void start() throws InterruptedException { Connection connection = null; connectionFactory = new ActiveMQConnectionFactory(); while (true) { try { connection = connectionFactory.createConnection(); System.out.println("connection succeeded"); } catch (JMSException e) { System.out.println("connection failed."); connection = null; } Thread.sleep(1000); } } } Analysing the heap, the number of "class [Lorg.apache.activemq.command.DataStructure;" grows by 1 for each failed createConnection() call. This 65KB object is an array of nulls, and is referenced by "References to this object: [EMAIL PROTECTED] (53 bytes) : field marshallCache" Please reply if there's a way around this. Right now we'll have to create a new connectionFactory each time. Regards, Emerson -- View this message in context: http://www.nabble.com/Memory-leak-in-ActiveMQConnectionFactory.-tf3123288.html#a8653808 Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.