Hello Mike, Thank you for your response. The interesting thing is we use a single EntityManagerFactory per JVM by using the Singleton pattern. I double checked the same heap dump and sure enough there only seems to be a single factory object in the analysis. We do keep this factory open for the lifetime of the web application, but that was following guidance from the OpenJPA documentation:
"Closing an EntityManagerFactory should not be taken lightly. It is much better to keep a factory open for a long period of time than to repeatedly create and close new factories. Thus, most applications will never close the factory, or only close it when the application is exiting. Only applications that require multiple factories with different configurations have an obvious reason to create and close multiple EntityManagerFactory instances." If we were to close the factory, when are where would you recommend we do it in the web application? Any advice on this matter is very much appreciated. Thanks, Darren Michael Dick wrote: > > Hi Darren, > > This is usually happens if the application creates a large number of > EntityManager*Factories*, which aren't closed. Take a look at the > application logic where you obtain the EMF, and make sure it gets closed > (or > cached appropriately). > > hope this helps, > -mike > > On Sat, Jun 27, 2009 at 10:54 AM, Darren Senel > <[email protected]>wrote: > >> >> Hello, >> >> We are using OpenJPA 1.2.0 in a WebSphere 6 web application. We are not >> using the EJB3 pack. We are seeing a very large proportion of the heap >> taken up by OpenJPA PCRegistry objects (as shown in image). We use >> compile >> time enhancement of our classes. Eventually with enough requests of >> under >> high load our servers fail with an OOM error as the heap is exhausted. >> The >> image below shows the heap analysis suspected leak subject. Also, this >> heap >> dump was taken when the heap was about 50% full. >> >> We open, use, flush, close and set to null the EntityManager objects we >> create. >> >> Would anyone have any ideas as to the cause of this growth of objects >> that >> eventually leads to our OOM crash? >> >> Many thanks, >> >> Darren >> >> http://n2.nabble.com/file/n3166851/HeapAnalysis.jpg >> -- >> View this message in context: >> http://n2.nabble.com/Memory-Usage-tp3166851p3166851.html >> Sent from the OpenJPA Users mailing list archive at Nabble.com. >> >> > > -- View this message in context: http://n2.nabble.com/Memory-Usage-tp3166851p3174602.html Sent from the OpenJPA Users mailing list archive at Nabble.com.
