From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Vladimir Davydov Subject: [PATCH 1.10 2/2] vinyl: free region on vylog commit instead of resetting it Date: Tue, 25 Jun 2019 15:46:05 +0300 Message-Id: In-Reply-To: References: In-Reply-To: References: To: tarantool-patches@freelists.org List-ID: region_reset() only frees memory from the last slab. As a result, if a vylog transaction happens to use more than one slab, memory used by vy_log.pool won't be freed, neither will it be reused, i.e. we'll get a memory leak. Fix it by using region_free() instead of region_reset(). It's okay from performance point of view, because vylog transactions are rare events. Note, the master branch isn't affected to this issue, because the vylog memory management was completely reworked there. 2.1 isn't affected either, because there region_reset() was modified to free all slabs. However, rather than backporting any of those commits, I think it's more appropriate to simply use region_free(). --- src/box/vy_log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/box/vy_log.c b/src/box/vy_log.c index a0c6480e..275d5d72 100644 --- a/src/box/vy_log.c +++ b/src/box/vy_log.c @@ -802,7 +802,7 @@ vy_log_flush(void) return -1; /* Success. Free flushed records. */ - region_reset(&vy_log.pool); + region_free(&vy_log.pool); stailq_create(&vy_log.tx); return 0; } -- 2.11.0