aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie2012-07-23 19:26:21 +0100
committerMelanie2012-07-23 19:26:21 +0100
commit55c1c10c0dc3f189107ab43b43988a8b8833f136 (patch)
treecba32fe1cdfcbcfd6ac9381141e9b4de88ece5b5
parentCommiting Avination's memleak fix-a-thon, installment #1 (diff)
downloadopensim-SC_OLD-55c1c10c0dc3f189107ab43b43988a8b8833f136.zip
opensim-SC_OLD-55c1c10c0dc3f189107ab43b43988a8b8833f136.tar.gz
opensim-SC_OLD-55c1c10c0dc3f189107ab43b43988a8b8833f136.tar.bz2
opensim-SC_OLD-55c1c10c0dc3f189107ab43b43988a8b8833f136.tar.xz
Committing Avination's memleak fix-a-thon, installment #2
Ensure items coming off the lockless queue are released. Also ensure this is done when the queue is cleared.
-rw-r--r--OpenSim/Framework/LocklessQueue.cs11
1 files changed, 10 insertions, 1 deletions
diff --git a/OpenSim/Framework/LocklessQueue.cs b/OpenSim/Framework/LocklessQueue.cs
index dd3d201..84f887c 100644
--- a/OpenSim/Framework/LocklessQueue.cs
+++ b/OpenSim/Framework/LocklessQueue.cs
@@ -99,8 +99,13 @@ namespace OpenSim.Framework
99 } 99 }
100 else 100 else
101 { 101 {
102 item = oldHeadNext.Item; 102 item = oldHeadNext.Item;
103 haveAdvancedHead = CAS(ref head, oldHead, oldHeadNext); 103 haveAdvancedHead = CAS(ref head, oldHead, oldHeadNext);
104 if (haveAdvancedHead)
105 {
106 oldHeadNext.Item = default(T);
107 oldHead.Next = null;
108 }
104 } 109 }
105 } 110 }
106 } 111 }
@@ -111,6 +116,10 @@ namespace OpenSim.Framework
111 116
112 public void Clear() 117 public void Clear()
113 { 118 {
119 // ugly
120 T item;
121 while(count > 0)
122 Dequeue(out item);
114 Init(); 123 Init();
115 } 124 }
116 125