This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes EntityManagerFactory init creates excessive objects? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "EntityManagerFactory init creates excessive objects?" Watch "EntityManagerFactory init creates excessive objects?" New topic
Author

EntityManagerFactory init creates excessive objects?

Michal Glowacki
Ranch Hand

Joined: Mar 14, 2006
Posts: 114
hi,

I am profiling my java web app with YourKit to reduce memory usage and I have found out that one of the biggest memory occupants is created by javax.persistence.Persistence.createEntityManagerFactory

Have a look at memory allociations tree:

Name, Recorded Objects, Size
javax.persistence.Persistence.createEntityManagerFactory(String) 390292 160876904

going into lower levels, I can see this:

org.hibernate.util.ReflectHelper.classForName(String) 60165 124122640

and it's 2 subnodes:

java.lang.ClassLoader.loadClass(String) 33334 37485640
java.lang.Class.forName(String) 26831 86637000

is this correct behaviour?
 
Consider Paul's rocket mass heater.
 
subject: EntityManagerFactory init creates excessive objects?