Search code examples
hibernateout-of-memoryheap-dump

Hibernate: OOM-Exception, problem with IdentityMap?


when loading lots of objects, I get a OOM-Exception. After analyzing the heap with a profiler, I see that there's a lot of memory in org/hibernate/util/IdentityMap which references a LinkedHashMap containing thousands of Entrys. What are those objects used for?

I'm really thankful for all kinds of information...

alt text


Solution

  • This is the entity cache of the persistence unit. Also known as first-level cache. All entities loaded from the database are kept in this cache so subsequent requests for an already known entity can be answered from the cache without issuing SQL queries.