From ddbebcda6c249e61d2164b62cf19ace3cd26ace0 Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Mon, 2 Jun 2014 07:11:27 -0700 Subject: [PATCH] Cleanup memory. --- src/xenia/cpu/xenon_memory.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/xenia/cpu/xenon_memory.cc b/src/xenia/cpu/xenon_memory.cc index adc96392f..1e4116bf3 100644 --- a/src/xenia/cpu/xenon_memory.cc +++ b/src/xenia/cpu/xenon_memory.cc @@ -233,6 +233,17 @@ XenonMemory::XenonMemory() : } XenonMemory::~XenonMemory() { + // Remove exception handlers. + RemoveVectoredExceptionHandler(CheckMMIOHandler); + RemoveVectoredContinueHandler(CheckMMIOHandler); + + // Unallocate mapped ranges. + for (int i = 0; i < g_mapped_range_count_; ++i) { + const auto& range = g_mapped_ranges_[i]; + VirtualFree(reinterpret_cast(range.address), range.size, + MEM_DECOMMIT); + } + if (mapping_base_) { // GPU writeback. VirtualFree(