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;