Reduce Session Factory memory footprint: drop reference to Configuration

Description

org.hibernate.cfg.Configuration object size depends on individual configuration. The configuration is used for session factory creation, then can be garbage collected during gc.

When setting the session factory observer, anonymous class is created (SessionFactoryObserver). This class has implicit reference to the outer class: org.hibernate.cfg.Configuration. Since the created observer object lives as long as session factory, the configuration object will never garbage collected.

Environment

All.

Assignee

Maxim Kirilov

Reporter

Maxim Kirilov

Fix versions

None

Labels

backPortable

None

Suitable for new contributors

Yes, likely

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Minor
Configure