Memory leak on org.hibernate.internal.SessionFactoryImpl

Good morning
I hava a problem with SessionFactory.
To create a SessionFactory I use this code

	public static SessionFactory getSessionFactory() {
		if (sessionFactory == null) {
			log.info("I'm creating a new SessionFactory Hibernate");
			// loads configuration and mappings
			Configuration configuration = new Configuration().configure();
			ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder()
					.applySettings(configuration.getProperties()).build();

			// builds a session factory from the service registry
			sessionFactory = configuration.buildSessionFactory(serviceRegistry);
		}

		return sessionFactory;
	}

When I run my app the log

log.info("I'm creating a new SessionFactory Hibernate");

is printed only one time as aspected.
The problem is that almost every day the JVM reboot because of Out Of Memory error.
I analyse the dump and in the Leaks section the first suspect is SessionFactory. This is the complete leak message

145 instances of “org.hibernate.internal.SessionFactoryImpl”, loaded by “org.apache.catalina.loader.ParallelWebappClassLoader @ 0x6b0073940”
occupy 3,723,001,840 (59.16%) bytes. These instances are referenced from one instance of “java.util.concurrent.ConcurrentHashMap$Node[]”,
loaded by “”

How is it possible that 145 instances of SessionFactoryImpl is created even if the creation log appears only one time?
How can I check who created them? There is some log that can I activate?
Thanks
Regards

You can create a memory dump on out of memory errors and analyze that with EclipseMAT (Eclipse Memory Analyzer Open Source Project | The Eclipse Foundation)

I found the problem
In my code I instantiated a new EntityManagerFactory whenever I needed a new EntityManager instance.

EntityManagerFactory emf = Persistence.createEntityManagerFactory("hibernateReference");
EntityManager em = emf.createEntityManager();

and at the end I forgot to close the EntityManager.
To solve the problem I create a singleton of the EntityManagerFactory

public static EntityManagerFactory getEntityManagerFactory() {
	if (emf == null) {
		emf = Persistence.createEntityManagerFactory("hibernateReference");
	}
	return emf;
}

and I added in my code in the finally statement

finally {
	if(em != null)
		em.close();
}

Make sure that your emf field is initialized safely e.g. by using the double checked locking idiom: https://www.baeldung.com/java-singleton-double-checked-locking