Our application is a standard web-app, for which we recently moved to using 
4.0.4RC1 and switched from session bean access and eager fetching to direct 
EntityManager access and lazy fetching (to simplify). Essentially now we're 
utilizing an EntityManagerFactory to get an EntityManager at the beginning of 
each request, using it throughout the request, and closing it at the end of the 
request (making sure that always, always happens of course).

What we're seeing is that after a rather low number of page requests (on the 
order of a dozen or two), we get:

17:04:50,756 ERROR [jsp] Exception happened while executing page: PermGen space 
java.lang.OutOfMemoryError: PermGen space
17:04:58,038 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception 
java.lang.OutOfMemoryError: PermGen space

This raises two questions, one being whether anyone's had similar memory leak 
issues when doing this; the second being whether it's more appropriate to try 
to minimize EntityManager creation. For instance, could a web app use a 
singleton EntityManager reference? Any multithreading issues with that? We 
could associate an EntityManager with a user session and re-use it, but that 
risks instances sticking around until each session expires.

Apologies if these questions are basic; the EJB3 world is a new one for us. 
Thanks for your assistance.


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3930573#3930573

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3930573


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to