diff --git a/hibernate-core/src/main/java/org/hibernate/engine/query/spi/QueryPlanCache.java b/hibernate-core/src/main/java/org/hibernate/engine/query/spi/QueryPlanCache.java index f3356a3bf6de..3abec770b27a 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/query/spi/QueryPlanCache.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/query/spi/QueryPlanCache.java @@ -220,7 +220,13 @@ public NativeSQLQueryPlan getNativeSQLQueryPlan(final NativeSQLQuerySpecificatio } /** - * clean up QueryPlanCache when SessionFactory is closed + * Clean up the caches when the SessionFactory is closed. + *

+ * Note that depending on the cache strategy implementation chosen, clearing the cache might not reclaim all the + * memory. + *

+ * Typically, when using LIRS, clearing the cache only invalidates the entries but the outdated entries are kept in + * memory until they are replaced by others. It is not considered a memory leak as the cache is bounded. */ public void cleanup() { LOG.trace( "Cleaning QueryPlan Cache" );