Search code examples
javajpamemory-leakseclipselinkglassfish-3

Memory leak, ChangeTracking JPA, Glassfish 3.1, Eclipselink 2.5


Just having a hard time finding a big memory leak in a java ee application running on a Glassfish 3.1.2 with Eclipselink 2.5.x

MAT Memory Analysis We have lot's of more instances of the user entity in memory than we have users in the database. And the change tracking of the persistence functionality is going mad with 8 MB for each user. At the end it spends more than 2 GB for something that should be maybe 2 MB.

Does anybody have an idea how something like this can happen?

I tried to reproduce it in a small application but could not see a similar behavior.


Solution

  • After splitting the parts of the DAO Service into pieces I found a way how to prevent this behaviour.

    I spareated the guave cache from the JPA components and I used Pojo's inside the cache instead of detached entities. So I'm 100% sure that there is nothing is referencing to the cached data.