I changed it so I only create the service object once and then each time I need a new client use getMyPort and set it up.. The docs aren't exactly clear, but it looks like I get distinct proxies back on each call, so I'm assuming that's safe? If I then call service.getMyPort() across multiple threads?

It still leaks about 6 megs each time I call getMyPort() and make a few remote requests. After any references I have to the new port object are gone and I've forced a few GCs,it looks like a bunch of data being left in a ThreadLocal. I'm still trying to unwind what happens behind the scenes when I setup a client fully, but I see a couple ThreadLocals in JaxWsClientProxy that might not be getting cleared?

--Joe

On Sep 4, 2007, at 10:10 PM, Liu, Jervis wrote:

Hi Joe, based on the information you supplied, I wont necessarily say there is a memory leak. Internally CXF runtime maintains a service model which is built either from WSDL or from POJO, both on the client side and server side. And this service model will keep alive until the server or client gets shut down. It can happen that a service model takes about 20MB for a WSDL of 1 MB. Having this said, we did fix several memory leaks before, for example, if you start a CXF client and invoke an operation several times then you find the memory usage increases steadily, then it is likely that you run into a memory leak problem.

Cheers,
Jervis


-----Original Message-----
From: Joe Sunday [mailto:[EMAIL PROTECTED]
Sent: 2007?9?5? 2:06
To: [email protected]
Subject: Memory leak in client?


Using 2.0.1, creating a client from a large wsdl (~1 MB) in my
classpath using generated stubs increases memory usage by about 20
MB, which never gets garbage collected. Later clients created from
the same WSDL url cause similar increases until I get an out of
memory condition.

static {
     WSDL_URL = MyService.class.getClassLoader().getResource
("myService.wsdl");
   SERVICE_QNAME = new QName("urn:myService", "MyService");
}

MyService service = new MyService(WSDL_URL, SERVICE_QNAME);
MyPort client = service.getMyPort();
BindingProvider provider = (BindingProvider)client;
provider.getRequestContext().put
(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpoint.getURL());
Client c = ClientProxy.getClient(client);
HTTPConduit conduit = (HTTPConduit)c.getConduit();
conduit.getClient().setAllowChunking(false);
// ... SSL setup too ...

Working through a heap dump now, but does this look familiar
to anyone?

--Joe



----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland

Reply via email to