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.
merge-requests/195/head
LotP1 2025-10-26 03:47:57 +01:00
parent 718652599d
commit 67198ee961
1 changed files with 3 additions and 3 deletions

View File

@ -7,11 +7,11 @@ namespace Ryujinx.Common
where T : class
{
private int _size = size;
private readonly ConcurrentStack<T> _items = new();
private readonly ConcurrentBag<T> _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);
}
}