From 8c52f54bfdf7f3ed08980e5d43874cffcdb4ace1 Mon Sep 17 00:00:00 2001 From: Badrish Chandramouli Date: Wed, 22 Mar 2023 18:22:32 -0700 Subject: [PATCH] Make sure HybridLogCheckpointInfo is disposed. --- cs/src/core/Index/Recovery/Recovery.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cs/src/core/Index/Recovery/Recovery.cs b/cs/src/core/Index/Recovery/Recovery.cs index 933c4e913..b74803a80 100644 --- a/cs/src/core/Index/Recovery/Recovery.cs +++ b/cs/src/core/Index/Recovery/Recovery.cs @@ -144,6 +144,7 @@ public void GetLatestCheckpointTokens(out Guid hlogToken, out Guid indexToken) { GetClosestHybridLogCheckpointInfo(-1, out hlogToken, out var recoveredHlcInfo, out var _); GetClosestIndexCheckpointInfo(ref recoveredHlcInfo, out indexToken, out var _); + recoveredHlcInfo.Dispose(); } /// @@ -152,10 +153,11 @@ public void GetLatestCheckpointTokens(out Guid hlogToken, out Guid indexToken) /// public long GetLatestCheckpointVersion() { - GetClosestHybridLogCheckpointInfo(-1, out var hlogToken, out var _, out var _); + GetClosestHybridLogCheckpointInfo(-1, out var hlogToken, out var hlcInfo, out var _); + hlcInfo.Dispose(); if (hlogToken == default) return -1; - HybridLogCheckpointInfo current = new(); + using var current = new HybridLogCheckpointInfo(); current.Recover(hlogToken, checkpointManager, hlog.LogPageSizeBits, out var _, false); return current.info.nextVersion; @@ -168,7 +170,7 @@ public long GetLatestCheckpointVersion() /// public long GetSnapshotFileSizes(Guid token) { - HybridLogCheckpointInfo current = new(); + using var current = new HybridLogCheckpointInfo(); current.Recover(token, checkpointManager, hlog.LogPageSizeBits, out var _, false); return current.info.finalLogicalAddress;