L.S., I'm not seeing anything obvious missing from this snippet of code. Have you tried taking a memory dump and use jmap or yourkit or something to find the objects that are causing the memore leak?
Regards, Gert Vanthienen ------------------------ Open Source SOA: http://fusesource.com Blog: http://gertvanthienen.blogspot.com/ 2009/11/20 Stuart Roe <[email protected]>: > Hi all, > > I appear to have a memory leak while performing an exchange and I'm unsure > how to identify it/correct it. Bascially, my application happily runs for a > few days and then fails with an out of memory exception. Using jconsole I > can see that the memory usage is bouncing around with a slow consistent > creap up. This is why I suspect a memory leak. > > The message path within the app is cxf-bc (ver. 2009.01) -> cxf-se (ver. > 2009.01) all running in SMX 3.3.1/WinXP. > > The handler in CXF-SE creates a new InOut message and sync. posts it to the > NMR, unmarshals the response into a reply. There is a copy of the handler > function below. I have removed the actual data handling and exceptions. > > My question is, I'm I missing some form of deallocation/close call that will > return/release an object and hence remove my memory leak? > I have found that replacing the message exchange from the handler and hard > wiring a response fixes the leak. > > Any help/pointers would be helpful. > > Stuart. > > BTW: > I'm using JiBX to marshal between NMR XML and Java objects (which may also > be the source of the problem). > > > public List<TypeConfigStatus> getConfigStatus() > try { > GetConfigStatusResponse response = null; > > DeliveryChannel ch = getContext().getDeliveryChannel(); > InOut exch = ch.createExchangeFactory().createInOutExchange(); > exch.setService(getService()); > exch.setInMessage(exch.createMessage()); > exch.getInMessage().setProperty("operation", "config-status"); > exch.getInMessage().setContent(new StringSource("<empty />")); > > if(ch.sendSync(exch)){ > NormalizedMessage amsg = exch.getOutMessage(); > try { > SourceTransformer trans = new SourceTransformer(); > String content = trans.contentToString(amsg); > IBindingFactory bfact = > BindingDirectory.getFactory(GetConfigStatusResponse.class); > IUnmarshallingContext uctx = bfact.createUnmarshallingContext(); > response = (GetConfigStatusResponse) uctx.unmarshalDocument(new > StringReader(content)); > > } catch > // block removed > }finally{ > exch.setStatus(ExchangeStatus.DONE); > ch.send(exch); > } > } > > // set result = cooked(response) > > return result; > } > >
