aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorMelanie2012-07-23 19:21:59 +0100
committerMelanie2012-07-23 19:21:59 +0100
commit7d16d0664e7d5395bcafac1ece6a87fe231ea598 (patch)
tree924641f5d087cdca099c7c4ebc080b4c62d411f5 /OpenSim/Framework
parentUpdate BulletSim DLLs and SOs (diff)
downloadopensim-SC_OLD-7d16d0664e7d5395bcafac1ece6a87fe231ea598.zip
opensim-SC_OLD-7d16d0664e7d5395bcafac1ece6a87fe231ea598.tar.gz
opensim-SC_OLD-7d16d0664e7d5395bcafac1ece6a87fe231ea598.tar.bz2
opensim-SC_OLD-7d16d0664e7d5395bcafac1ece6a87fe231ea598.tar.xz
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.
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/MinHeap.cs12
1 files changed, 8 insertions, 4 deletions
diff --git a/OpenSim/Framework/MinHeap.cs b/OpenSim/Framework/MinHeap.cs
index 33d0364..99ac25d 100644
--- a/OpenSim/Framework/MinHeap.cs
+++ b/OpenSim/Framework/MinHeap.cs
@@ -63,12 +63,15 @@ namespace OpenSim.Framework
63 63
64 internal void Clear() 64 internal void Clear()
65 { 65 {
66 this.value = default(T);
67 if (this.handle != null) 66 if (this.handle != null)
68 {
69 this.handle.Clear(); 67 this.handle.Clear();
70 this.handle = null; 68 ClearRef();
71 } 69 }
70
71 internal void ClearRef()
72 {
73 this.value = default(T);
74 this.handle = null;
72 } 75 }
73 } 76 }
74 77
@@ -285,6 +288,7 @@ namespace OpenSim.Framework
285 if (--this.size > 0 && index != this.size) 288 if (--this.size > 0 && index != this.size)
286 { 289 {
287 Set(this.items[this.size], index); 290 Set(this.items[this.size], index);
291 this.items[this.size].ClearRef();
288 if (!BubbleUp(index)) 292 if (!BubbleUp(index))
289 BubbleDown(index); 293 BubbleDown(index);
290 } 294 }