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:
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.