Hi, normally they are garbaged collected once the transaction ends. If you use it without transaction you can need to call clear() once you are done.
Romain Manni-Bucau @rmannibucau <https://twitter.com/rmannibucau> | Blog <https://rmannibucau.metawerx.net/> | Old Blog <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> | LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book <https://www.packtpub.com/application-development/java-ee-8-high-performance> 2018-02-07 16:44 GMT+01:00 cocorossello <[email protected]>: > Hi, > > We are having some memory problems in our applications. We are using tomee > 7.0.4 with eclipselink, no second cache level. Most of the application are > @ApplicationScoped. > > Transaction is managed by container (JTA), no extended transactions at all, > everything we do with persistence is through the entity manager, which is > always injected with: > @PersistenceContext(unitName = "travelcPU") > private EntityManager entityManager; > > > I have isolated one production server, and waited until all sessions are > dead and then flushed all caches and then I took a heapdump. It's still > 1.6Gb, even with no information, I think it's quite big. > > I can see in the heapdump some 22K > org.apache.openejb.persistence.JtaEntityManager . And then (And I'm not > sure > if it's related to JtaEntityManager) a lot of QueryBasedValueHolder which > are in fact holding references to a lot of our domain objects. > > So, my question is, shouldn't those JtaEntityManager be cleared on GC? I > think that they don't hold references to the eclipselink EnityManager, so > the problem probably comes from another part, but can you confirm? > > Thanks in advance. > > > > -- > Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Users- > f979441.html >
