Explorar el Código

fix: for pooled memory used for reference types, clear it on return to the pool so that it doesn't prevent GC of the instances it contained (#6937)

jhorv hace 1 año
padre
commit
311ca3c3f1

+ 1 - 1
src/Ryujinx.Common/Memory/MemoryOwner.cs

@@ -124,7 +124,7 @@ namespace Ryujinx.Common.Memory
 
             if (array is not null)
             {
-                ArrayPool<T>.Shared.Return(array);
+                ArrayPool<T>.Shared.Return(array, RuntimeHelpers.IsReferenceOrContainsReferences<T>());
             }
         }
 

+ 1 - 1
src/Ryujinx.Common/Memory/SpanOwner.cs

@@ -108,7 +108,7 @@ namespace Ryujinx.Common.Memory
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public void Dispose()
         {
-            ArrayPool<T>.Shared.Return(_array);
+            ArrayPool<T>.Shared.Return(_array, RuntimeHelpers.IsReferenceOrContainsReferences<T>());
         }
     }
 }

+ 1 - 1
src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/Syscall.cs

@@ -616,7 +616,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
                 }
             }
 
-            ArrayPool<KSynchronizationObject>.Shared.Return(syncObjsArray);
+            ArrayPool<KSynchronizationObject>.Shared.Return(syncObjsArray, true);
 
             return result;
         }

+ 1 - 1
src/Ryujinx.HLE/HOS/Kernel/Threading/KSynchronization.cs

@@ -104,7 +104,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading
                     }
                 }
 
-                ArrayPool<LinkedListNode<KThread>>.Shared.Return(syncNodesArray);
+                ArrayPool<LinkedListNode<KThread>>.Shared.Return(syncNodesArray, true);
             }
 
             _context.CriticalSection.Leave();