Commiting Avination's memleak fix-a-thon, installment #1

As the MinHeap shrinks, free object references that have been sent. Also,
free the last item when it empties.
0.7.3-extended
Melanie 2012-07-23 19:21:59 +01:00 committed by Justin Clark-Casey (justincc)
parent 9ea09d785c
commit ed962bb3d3
1 changed files with 8 additions and 4 deletions

View File

@ -63,12 +63,15 @@ namespace OpenSim.Framework
internal void Clear()
{
this.value = default(T);
if (this.handle != null)
{
this.handle.Clear();
this.handle = null;
}
ClearRef();
}
internal void ClearRef()
{
this.value = default(T);
this.handle = null;
}
}
@ -285,6 +288,7 @@ namespace OpenSim.Framework
if (--this.size > 0 && index != this.size)
{
Set(this.items[this.size], index);
this.items[this.size].ClearRef();
if (!BubbleUp(index))
BubbleDown(index);
}