diff options
author | UbitUmarov | 2019-04-15 23:32:22 +0100 |
---|---|---|
committer | UbitUmarov | 2019-04-15 23:32:22 +0100 |
commit | a83b7a292bc3c18c9c6a1aa17cfc2622b99804c4 (patch) | |
tree | 335491b0008480e334331b9e38ccb453a189bc46 /OpenSim/Region/ScriptEngine/YEngine/XMRInstAbstract.cs | |
parent | update warp3d.dll (diff) | |
download | opensim-SC-a83b7a292bc3c18c9c6a1aa17cfc2622b99804c4.zip opensim-SC-a83b7a292bc3c18c9c6a1aa17cfc2622b99804c4.tar.gz opensim-SC-a83b7a292bc3c18c9c6a1aa17cfc2622b99804c4.tar.bz2 opensim-SC-a83b7a292bc3c18c9c6a1aa17cfc2622b99804c4.tar.xz |
mantis 8518: Yengine; we can't wait for GC (worse finalizers) to count released memory of some local variables, so add a pseudo free; fix memory account on timeslice rentry; change the folder for the debug IL files; fix memory usage on reset. This changes will only take effect on new compiles
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/YEngine/XMRInstAbstract.cs | 59 |
1 files changed, 30 insertions, 29 deletions
diff --git a/OpenSim/Region/ScriptEngine/YEngine/XMRInstAbstract.cs b/OpenSim/Region/ScriptEngine/YEngine/XMRInstAbstract.cs index a440cf3..f21116e 100644 --- a/OpenSim/Region/ScriptEngine/YEngine/XMRInstAbstract.cs +++ b/OpenSim/Region/ScriptEngine/YEngine/XMRInstAbstract.cs | |||
@@ -84,17 +84,36 @@ namespace OpenSim.Region.ScriptEngine.Yengine | |||
84 | heapUse = instance.UpdateHeapUse(heapUse, 0); | 84 | heapUse = instance.UpdateHeapUse(heapUse, 0); |
85 | } | 85 | } |
86 | 86 | ||
87 | public void Clear() | ||
88 | { | ||
89 | heapUse = 0; | ||
90 | if(iarArrays != null) | ||
91 | { | ||
92 | foreach(XMR_Array xa in iarArrays) | ||
93 | xa.__pub_clear(); | ||
94 | } | ||
95 | if(iarChars != null) | ||
96 | iarChars = new char[iarChars.Length]; | ||
97 | if (iarLists != null) | ||
98 | iarLists = new LSL_List[iarLists.Length]; | ||
99 | if (iarObjects != null) | ||
100 | iarObjects = new object[iarObjects.Length]; | ||
101 | if(iarStrings != null) | ||
102 | iarStrings = new string[iarStrings.Length]; | ||
103 | } | ||
104 | |||
87 | public void AllocVarArrays(XMRInstArSizes ars) | 105 | public void AllocVarArrays(XMRInstArSizes ars) |
88 | { | 106 | { |
89 | ClearOldArrays(); | 107 | ClearOldArrays(); |
108 | int newuse = heapUse + | ||
109 | ars.iasChars* HeapTrackerObject.HT_CHAR + | ||
110 | ars.iasFloats * HeapTrackerObject.HT_SFLT + | ||
111 | ars.iasIntegers * HeapTrackerObject.HT_INT + | ||
112 | ars.iasRotations * HeapTrackerObject.HT_ROT + | ||
113 | ars.iasVectors * HeapTrackerObject.HT_VEC + | ||
114 | ars.iasSDTIntfObjs * HeapTrackerObject.HT_DELE; | ||
90 | 115 | ||
91 | heapUse = instance.UpdateHeapUse(heapUse, | 116 | heapUse = instance.UpdateHeapUse(heapUse, newuse); |
92 | ars.iasChars * HeapTrackerObject.HT_CHAR + | ||
93 | ars.iasFloats * HeapTrackerObject.HT_SFLT + | ||
94 | ars.iasIntegers * HeapTrackerObject.HT_INT + | ||
95 | ars.iasRotations * HeapTrackerObject.HT_ROT + | ||
96 | ars.iasVectors * HeapTrackerObject.HT_VEC + | ||
97 | ars.iasSDTIntfObjs * HeapTrackerObject.HT_DELE); | ||
98 | 117 | ||
99 | iarArrays = (ars.iasArrays > 0) ? new XMR_Array[ars.iasArrays] : noArrays; | 118 | iarArrays = (ars.iasArrays > 0) ? new XMR_Array[ars.iasArrays] : noArrays; |
100 | iarChars = (ars.iasChars > 0) ? new char[ars.iasChars] : noChars; | 119 | iarChars = (ars.iasChars > 0) ? new char[ars.iasChars] : noChars; |
@@ -424,31 +443,13 @@ namespace OpenSim.Region.ScriptEngine.Yengine | |||
424 | \**************************************************/ | 443 | \**************************************************/ |
425 | 444 | ||
426 | protected int heapLimit; | 445 | protected int heapLimit; |
427 | private int heapUsed; | 446 | protected int heapUsed; |
428 | 447 | ||
429 | public virtual int UpdateHeapUse(int olduse, int newuse) | 448 | public virtual int UpdateHeapUse(int olduse, int newuse) |
430 | { | 449 | { |
431 | if(newuse <= olduse) | 450 | int newtotal = Interlocked.Add(ref heapUsed, newuse - olduse); |
432 | Interlocked.Add(ref heapUsed, newuse - olduse); | 451 | if(newtotal > heapLimit) |
433 | else | 452 | throw new OutOfHeapException(newtotal + olduse - newuse, newtotal, heapLimit); |
434 | { | ||
435 | int newtotal, oldtotal; | ||
436 | do | ||
437 | { | ||
438 | oldtotal = Interlocked.Add(ref heapUsed, 0); | ||
439 | newtotal = oldtotal + newuse - olduse; | ||
440 | if(newtotal > heapLimit) | ||
441 | { | ||
442 | // System.GC.Collect (); | ||
443 | // System.GC.WaitForPendingFinalizers (); | ||
444 | oldtotal = Interlocked.Add(ref heapUsed, 0); | ||
445 | newtotal = oldtotal + newuse - olduse; | ||
446 | if(newtotal > heapLimit) | ||
447 | throw new OutOfHeapException(oldtotal, newtotal, heapLimit); | ||
448 | } | ||
449 | } while(Interlocked.CompareExchange(ref heapUsed, newtotal, oldtotal) != oldtotal); | ||
450 | } | ||
451 | |||
452 | return newuse; | 453 | return newuse; |
453 | } | 454 | } |
454 | 455 | ||