mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2025-02-23 22:35:39 +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 void RecalculateMemoryTimings();
|
||||||
|
|
||||||
static bool AllocateMemory();
|
static bool AllocateMemory();
|
||||||
|
static void ReleaseMemory();
|
||||||
|
|
||||||
static void SetCodePageFastmemProtection(u32 page_index, bool writable);
|
static void SetCodePageFastmemProtection(u32 page_index, bool writable);
|
||||||
|
|
||||||
|
@ -149,11 +150,7 @@ void Shutdown()
|
||||||
CPU::g_state.fastmem_base = nullptr;
|
CPU::g_state.fastmem_base = nullptr;
|
||||||
m_fastmem_mode = CPUFastmemMode::Disabled;
|
m_fastmem_mode = CPUFastmemMode::Disabled;
|
||||||
|
|
||||||
if (g_ram)
|
ReleaseMemory();
|
||||||
{
|
|
||||||
m_memory_arena.ReleaseViewPtr(g_ram, RAM_SIZE);
|
|
||||||
g_ram = nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Reset()
|
void Reset()
|
||||||
|
@ -276,9 +273,21 @@ bool AllocateMemory()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Log_InfoPrintf("RAM is %u bytes at %p", RAM_SIZE, g_ram);
|
||||||
return true;
|
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)
|
static ALWAYS_INLINE u32 FastmemAddressToLUTPageIndex(u32 address)
|
||||||
{
|
{
|
||||||
return address >> 12;
|
return address >> 12;
|
||||||
|
|
Loading…
Reference in a new issue