mirror of
				https://github.com/ryujinx-mirror/ryujinx.git
				synced 2025-11-04 08:59:04 -06:00 
			
		
		
		
	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)
This commit is contained in:
		@@ -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>());
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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>());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -616,7 +616,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            ArrayPool<KSynchronizationObject>.Shared.Return(syncObjsArray);
 | 
			
		||||
            ArrayPool<KSynchronizationObject>.Shared.Return(syncObjsArray, true);
 | 
			
		||||
 | 
			
		||||
            return result;
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -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();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user