From bb616ce91c3cacb3be9db413a36b5cc8b4f35fd9 Mon Sep 17 00:00:00 2001 From: Thog Date: Sat, 25 Jan 2020 15:14:10 +0100 Subject: [PATCH] Make sure to dispose the page table and ThreadContext Less memory leaks! --- ARMeilleure/Instructions/NativeInterface.cs | 7 +++++++ Ryujinx.HLE/HOS/Kernel/Process/KProcess.cs | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/ARMeilleure/Instructions/NativeInterface.cs b/ARMeilleure/Instructions/NativeInterface.cs index 3a1e91c8ed..ba0b936a76 100644 --- a/ARMeilleure/Instructions/NativeInterface.cs +++ b/ARMeilleure/Instructions/NativeInterface.cs @@ -24,6 +24,11 @@ namespace ARMeilleure.Instructions ExclusiveAddress = ulong.MaxValue; } + + public void Dispose() + { + Context.Dispose(); + } } [ThreadStatic] @@ -36,6 +41,8 @@ namespace ARMeilleure.Instructions public static void UnregisterThread() { + _context.Dispose(); + _context = null; } diff --git a/Ryujinx.HLE/HOS/Kernel/Process/KProcess.cs b/Ryujinx.HLE/HOS/Kernel/Process/KProcess.cs index f987c83c01..7807ec5a68 100644 --- a/Ryujinx.HLE/HOS/Kernel/Process/KProcess.cs +++ b/Ryujinx.HLE/HOS/Kernel/Process/KProcess.cs @@ -1131,5 +1131,10 @@ namespace Ryujinx.HLE.HOS.Kernel.Process { throw new UndefinedInstructionException(e.Address, e.OpCode); } + + protected override void Destroy() + { + CpuMemory.Dispose(); + } } } \ No newline at end of file