From 67198ee9613a849869060c03b81532ffc77b70c2 Mon Sep 17 00:00:00 2001 From: LotP1 <68976644+LotP1@users.noreply.github.com> Date: Sun, 26 Oct 2025 03:47:57 +0100 Subject: [PATCH] switch to concurrent bag concurrent stack uses nodes, which allocates more memory than necessary. concurrent bag is not ordered and therefore doesn't need nodes. --- src/Ryujinx.Common/Pools/ObjectPool.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Ryujinx.Common/Pools/ObjectPool.cs b/src/Ryujinx.Common/Pools/ObjectPool.cs index ad56a04a2..de8534332 100644 --- a/src/Ryujinx.Common/Pools/ObjectPool.cs +++ b/src/Ryujinx.Common/Pools/ObjectPool.cs @@ -7,11 +7,11 @@ namespace Ryujinx.Common where T : class { private int _size = size; - private readonly ConcurrentStack _items = new(); + private readonly ConcurrentBag _items = new(); public T Allocate() { - bool success = _items.TryPop(out T instance); + bool success = _items.TryTake(out T instance); if (!success) { @@ -25,7 +25,7 @@ namespace Ryujinx.Common { if (_size < 0 || _items.Count < _size) { - _items.Push(obj); + _items.Add(obj); } }