Using MQQueueConnectionFactory - memory leak

Hi all.

We had Java agent that connects to MQ server and reads messages from it. It works fine on Domino 6.5 for a long time. Than we moved this agent on Domino 8.5 and it produces memory leak and OutOfMemory as result.

I investigated it and found that problem is with using of MQQueueConnectionFactory. We create this factory, than create JMSTemplate and set factory to template. And finally receive messages.

Code is:

To create factory:

public void connect(String hostName, int port, String mqManager, String channel) {

    cf = new MQQueueConnectionFactory();

    qManagerName = mqManager;

    try {

        cf.setQueueManager(mqManager);

        cf.setHostName(hostName);

        cf.setPort(port);

        cf.setTransportType(1);

        if (channel != null && channel.length() > 0) {

            cf.setChannel(channel);

        }

    } catch (JMSException e) {

        e.printStackTrace();

    }  

}

And to read messages:

public String readMessage() {

    String result = null;

    try {

        JmsTemplate t = new JmsTemplate();

        t.setConnectionFactory(cf);

        t.setDefaultDestination(q);

        t.setReceiveTimeout(2000);

        Message resultMsg = t.receive();

        if (resultMsg != null) {

            result = ((TextMessage) resultMsg).getText();

        }

    } catch (JMSException e) {

        e.printStackTrace();

    }

    return result;  

}

In all possible places recyle() is invoking.

Max heap size is 512 Mb. When agent run on 8.5 server it takes additional ~50-60Mb per launch. Increasing to 1Gb just allow to have several more launches. Agent is invoking as RunOnServer from Agents list.

Any ideas?

Thanks in advance

Subject: closed