mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2025-01-30 19:45:37 +00:00
Bus: Don't leak shared memory when starting->stopping->starting
This commit is contained in:
parent
91995c92db
commit
68dc052432
|
@ -106,6 +106,7 @@ static std::tuple<TickCount, TickCount, TickCount> CalculateMemoryTiming(MEMDELA
|
|||
static void RecalculateMemoryTimings();
|
||||
|
||||
static bool AllocateMemory();
|
||||
static void ReleaseMemory();
|
||||
|
||||
static void SetCodePageFastmemProtection(u32 page_index, bool writable);
|
||||
|
||||
|
@ -149,11 +150,7 @@ void Shutdown()
|
|||
CPU::g_state.fastmem_base = nullptr;
|
||||
m_fastmem_mode = CPUFastmemMode::Disabled;
|
||||
|
||||
if (g_ram)
|
||||
{
|
||||
m_memory_arena.ReleaseViewPtr(g_ram, RAM_SIZE);
|
||||
g_ram = nullptr;
|
||||
}
|
||||
ReleaseMemory();
|
||||
}
|
||||
|
||||
void Reset()
|
||||
|
@ -276,9 +273,21 @@ bool AllocateMemory()
|
|||
return false;
|
||||
}
|
||||
|
||||
Log_InfoPrintf("RAM is %u bytes at %p", RAM_SIZE, g_ram);
|
||||
return true;
|
||||
}
|
||||
|
||||
void ReleaseMemory()
|
||||
{
|
||||
if (g_ram)
|
||||
{
|
||||
m_memory_arena.ReleaseViewPtr(g_ram, RAM_SIZE);
|
||||
g_ram = nullptr;
|
||||
}
|
||||
|
||||
m_memory_arena.Destroy();
|
||||
}
|
||||
|
||||
static ALWAYS_INLINE u32 FastmemAddressToLUTPageIndex(u32 address)
|
||||
{
|
||||
return address >> 12;
|
||||
|
|
Loading…
Reference in a new issue