We found possible memory leak in BoundedConcurrentHashMap.LIRS implementation.
I think that problem is in a org.hibernate.internal.util.collections.BoundedConcurrentHashMap.LIRS.clear() method.
This method clear an accessQueue variable but LIRS stack (represented by a header variable) is not cleared.
I attached an image from heap analysis to demonstrate this problem.
In this example SessionFactoryImpl is properly closed (method close() is called on every instance of LIRS).