I have ~15,000 identical SessionFactoryImpl objects in my dump:
One of the objects with incoming references:
One of the objects with outbound references:
I don’t have the following parameters configured and they are set by default accordingly:
- Why are there so many SessionFactoryImpl objects and why aren’t they deleted?
- Are they created incorrectly somewhere in the code, or is it due to unspecified caching parameters?
- If so, what parameters should I set for caching?
- Should I set any other settings?
- If these objects are created in code, how can I find the class that creates these objects in Jprofiler?
- Hibernate 5.4.3.Final
- Spring 5.1.6.RELEASE
The problem was in the incorrectly implemented method of logging to the database. When a certain task was completed, factories for logging were always created, which had a reference to the SessionFactoryImpl. And there were many such tasks, and each time these factories were created. We were able to find this place in the code and fix it so that the log factory was created once when the application was launched.