added gc config and switched gc states on application start/stop

This commit is contained in:
Max 2026-05-09 09:05:14 -04:00
parent bf083a716c
commit 9126f5b377
3 changed files with 21 additions and 0 deletions

View file

@ -115,6 +115,12 @@ namespace Ryujinx.Ava
public static AppBuilder BuildAvaloniaApp() =>
AppBuilder.Configure<RyujinxApp>()
.UsePlatformDetect()
// Vulkan UI rendering performs better, but its unpolished, and as such it lacks effective transparency.
// https://github.com/AvaloniaUI/Avalonia/issues/19378
// https://github.com/AvaloniaUI/Avalonia/issues/9610
// X11RenderingMode.Glx && X11RenderingMode.Egl, Win32RenderingMode.Vulkan have these issues.
.With(new X11PlatformOptions
{
EnableMultiTouch = true,

View file

@ -46,6 +46,7 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Runtime;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
@ -662,6 +663,7 @@ namespace Ryujinx.Ava.Systems
_chrono.Stop();
_playTimer.Stop();
GCSettings.LatencyMode = GCLatencyMode.Interactive;
}
public void DisposeGpu()
@ -916,6 +918,7 @@ namespace Ryujinx.Ava.Systems
appMetadata => appMetadata.UpdatePreGame()
);
_playTimer.Start();
GCSettings.LatencyMode = GCLatencyMode.SustainedLowLatency;
}
internal void Resume()
@ -926,6 +929,7 @@ namespace Ryujinx.Ava.Systems
_playTimer.Start();
_viewModel.Title = TitleHelper.ActiveApplicationTitle(Device?.Processes.ActiveApplication, Program.Version, !ConfigurationState.Instance.ShowOldUI);
Logger.Info?.Print(LogClass.Emulation, "Emulation was resumed.");
GCSettings.LatencyMode = GCLatencyMode.SustainedLowLatency;
}
internal void Pause()
@ -936,6 +940,7 @@ namespace Ryujinx.Ava.Systems
_playTimer.Stop();
_viewModel.Title = TitleHelper.ActiveApplicationTitle(Device?.Processes.ActiveApplication, Program.Version, !ConfigurationState.Instance.ShowOldUI, LocaleManager.Instance[LocaleKeys.Paused]);
Logger.Info?.Print(LogClass.Emulation, "Emulation was paused.");
GCSettings.LatencyMode = GCLatencyMode.Interactive;
}
private void InitEmulatedSwitch()

View file

@ -0,0 +1,10 @@
{
"configProperties": {
"System.GC.Concurrent": true,
"System.GC.RetainVM": true,
"System.GC.DynamicAdaptation": 0,
"System.GC.Server": true,
"System.GC.HeapCount": 4,
"System.GC.NoAffinitize": 0
}
}