Apply fix for problems with LRUCache not properly cleaning up after itself.
Fixes [AMQNET-AMQNET-521]. (See https://issues.apache.org/jira/browse/AMQNET-AMQNET-521)
diff --git a/src/main/csharp/Util/LRUCache.cs b/src/main/csharp/Util/LRUCache.cs
index ec3d7b9..0fcdb90 100644
--- a/src/main/csharp/Util/LRUCache.cs
+++ b/src/main/csharp/Util/LRUCache.cs
@@ -47,6 +47,7 @@
public void Clear()
{
dictionary.Clear();
+ entries.Clear();
}
public int Count
@@ -65,12 +66,12 @@
get { return dictionary[key]; }
set
{
- TValue currentValue = default (TValue);
+ TValue currentValue;
// Moved used item to end of list since it been used again.
if (dictionary.TryGetValue(key, out currentValue))
{
KeyValuePair<TKey, TValue> entry =
- new KeyValuePair<TKey, TValue>(key, value);
+ new KeyValuePair<TKey, TValue>(key, currentValue);
entries.Remove(entry);
}