diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/YEngine/XMRInstAbstract.cs | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/OpenSim/Region/ScriptEngine/YEngine/XMRInstAbstract.cs b/OpenSim/Region/ScriptEngine/YEngine/XMRInstAbstract.cs index dec775f..32aea25 100644 --- a/OpenSim/Region/ScriptEngine/YEngine/XMRInstAbstract.cs +++ b/OpenSim/Region/ScriptEngine/YEngine/XMRInstAbstract.cs | |||
@@ -453,11 +453,13 @@ namespace OpenSim.Region.ScriptEngine.Yengine | |||
453 | \**************************************************/ | 453 | \**************************************************/ |
454 | 454 | ||
455 | protected int heapLimit; | 455 | protected int heapLimit; |
456 | protected int heapUsed; | 456 | public int m_heapUsed; |
457 | 457 | ||
458 | public virtual int UpdateHeapUse(int olduse, int newuse) | 458 | public virtual int UpdateHeapUse(int olduse, int newuse) |
459 | { | 459 | { |
460 | int newtotal = Interlocked.Add(ref heapUsed, newuse - olduse); | 460 | if (m_heapUsed < 0) |
461 | m_heapUsed = 0; | ||
462 | int newtotal = Interlocked.Add(ref m_heapUsed, newuse - olduse); | ||
461 | if(newtotal > heapLimit) | 463 | if(newtotal > heapLimit) |
462 | throw new OutOfHeapException(newtotal + olduse - newuse, newtotal, heapLimit); | 464 | throw new OutOfHeapException(newtotal + olduse - newuse, newtotal, heapLimit); |
463 | return newuse; | 465 | return newuse; |
@@ -465,17 +467,21 @@ namespace OpenSim.Region.ScriptEngine.Yengine | |||
465 | 467 | ||
466 | public virtual void AddHeapUse(int delta) | 468 | public virtual void AddHeapUse(int delta) |
467 | { | 469 | { |
468 | Interlocked.Add(ref heapUsed, delta); | 470 | Interlocked.Add(ref m_heapUsed, delta); |
469 | } | 471 | } |
470 | 472 | ||
471 | public int xmrHeapLeft() | 473 | public int xmrHeapLeft() |
472 | { | 474 | { |
473 | return heapLimit - heapUsed; | 475 | if (m_heapUsed < 0) |
476 | m_heapUsed = 0; | ||
477 | return heapLimit - m_heapUsed; | ||
474 | } | 478 | } |
475 | 479 | ||
476 | public int xmrHeapUsed() | 480 | public int xmrHeapUsed() |
477 | { | 481 | { |
478 | return heapUsed; | 482 | if(m_heapUsed < 0) |
483 | m_heapUsed = 0; | ||
484 | return m_heapUsed; | ||
479 | } | 485 | } |
480 | 486 | ||
481 | /** | 487 | /** |