My Java / Tomcat / Eclipselink / Application-managed EntityManager / app fullfills the memory after some hours running and I have been trying to find the cause of it. I get millions of objects of type UnitOfWorkQuery
I have tried to stop every background process and even no transactions are execution UnitOfWorkQuery objects remain in memory:
I use ThreadLocal to ensure that EntityManager objects are isolated between transactions and after every use EM objects are closed and removed from ThreadLocal.
Question 1: is the presence of UnitOfWorkQuery saying that L1 cache is kept in memory and GC is unable to remove it?
Question 2: Where is L2 cache storing the data? UnitOfWorkQueryValueHolder grows when new querys are triggered but “shrinks” when GC is triggered. Does UnitOfWorkQuery have anything to do with L2 cache as well?