The method org.hibernate.engine.internal.EntityEntryContext#reentrantSafeEntityEntries is allocating a defensive copy of the data structure for iteration, but this has been shown as not being very efficient in terms of memory allocations. We should explore alternatives, especially as I’ve noticed since ORM 6 this method is now only used by a single path: the Session#clear() method. Hopefully that simplifies things. |