| Thank you for the thorough investigation into this problem! The problem is that we are not in fact using the EntityManager in this way. I merely tried to reproduce the problem with as little code as possible using an example from Jboss/Narayana. We are in fact using Spring in combination with Narayana and Hibernate. We have an environment which is, for the most part, message driven through Spring's DefaultMessageListenerContainer. So it is actually this Spring code that is doing the calls to the JtaTransactionManager. Our EntityManager is (of course) injected through the @PersistenceContext annotation. So the code to close the EntityManager is not actually in our own codebase. But I cannot post the sources of our application publicly and it is also too massive (thousands of classes) too be used as an 'example'. I will start working on an example to recreate the memory leak in a manner that more resembles our environment. |