diff options
| author | jhorv <38920027+jhorv@users.noreply.github.com> | 2024-06-16 16:47:47 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-16 17:47:47 -0300 |
| commit | 311ca3c3f1719c0effeedfb8cf90d9f2675ef8a5 (patch) | |
| tree | 769ffd984001a7b35eea5d64af53873b89ddc05e /src/Ryujinx.Common | |
| parent | 3193ef10833bc0d27e2701c7759ab02674d672d3 (diff) | |
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)
Diffstat (limited to 'src/Ryujinx.Common')
| -rw-r--r-- | src/Ryujinx.Common/Memory/MemoryOwner.cs | 2 | ||||
| -rw-r--r-- | src/Ryujinx.Common/Memory/SpanOwner.cs | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/Ryujinx.Common/Memory/MemoryOwner.cs b/src/Ryujinx.Common/Memory/MemoryOwner.cs index 5e567ab8..b7fe1db7 100644 --- a/src/Ryujinx.Common/Memory/MemoryOwner.cs +++ b/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>()); } } diff --git a/src/Ryujinx.Common/Memory/SpanOwner.cs b/src/Ryujinx.Common/Memory/SpanOwner.cs index a4b4adf3..acb20bca 100644 --- a/src/Ryujinx.Common/Memory/SpanOwner.cs +++ b/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>()); } } } |
