From ad4978c36a4241244088f7ebc96e68399cd1e617 Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Wed, 8 Aug 2018 16:21:25 +0200 Subject: [PATCH] HHH-10782 Add a comment about what clearing the query plan cache means --- .../org/hibernate/engine/query/spi/QueryPlanCache.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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" );