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.0.7.3-extended
parent
91ae1908fe
commit
2d66fcd4cd
|
@ -101,6 +101,11 @@ namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
item = oldHeadNext.Item;
|
item = oldHeadNext.Item;
|
||||||
haveAdvancedHead = CAS(ref head, oldHead, oldHeadNext);
|
haveAdvancedHead = CAS(ref head, oldHead, oldHeadNext);
|
||||||
|
if (haveAdvancedHead)
|
||||||
|
{
|
||||||
|
oldHeadNext.Item = default(T);
|
||||||
|
oldHead.Next = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,6 +116,10 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
public void Clear()
|
public void Clear()
|
||||||
{
|
{
|
||||||
|
// ugly
|
||||||
|
T item;
|
||||||
|
while(count > 0)
|
||||||
|
Dequeue(out item);
|
||||||
Init();
|
Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue