From cf284865e9d6846f01579066f632bceb3c073344 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Lema=C5=84czyk?= Date: Thu, 16 Mar 2023 02:24:18 +0100 Subject: [PATCH] RecyclableList finalizer added to make sure that the recyclable arrays are correctly returned. --- Recyclable.Collections/RecyclableList.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Recyclable.Collections/RecyclableList.cs b/Recyclable.Collections/RecyclableList.cs index 6c4323e..a67aeb7 100644 --- a/Recyclable.Collections/RecyclableList.cs +++ b/Recyclable.Collections/RecyclableList.cs @@ -779,8 +779,15 @@ namespace Recyclable.Collections IEnumerator IEnumerable.GetEnumerator() => _memoryBlocks.Enumerate(_blockSize, LongCount).GetEnumerator(); + ~RecyclableList() + { + // Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method + Dispose(); + } + public void Dispose() { + // Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method if (_capacity > 0) { Clear();