• Post Reply Bookmark Topic Watch Topic
  • New Topic

EntityManagerFactory init creates excessive objects?  RSS feed

Michal Glowacki
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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?
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!