diff options
| author | Soren Jorvang <soren.jorvang@gmail.com> | 2010-06-26 12:52:57 +0000 |
|---|---|---|
| committer | Soren Jorvang <soren.jorvang@gmail.com> | 2010-06-26 12:52:57 +0000 |
| commit | ebbfba62a0259602feecaf3a1ecb3e2992880b3c (patch) | |
| tree | 4c8b828261bba012e67c3e54dc301adcb214ffca /Source/Core | |
| parent | 67d5d89388feed96f0c30f91e26c079c94496858 (diff) | |
On OS X, add autorelease pools to the cpu and emu threads to avoid
leaking memory. This is necessary because the wxgl code called from
those threads relies on deferred release.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5792 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/Core/Src/Core.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/Source/Core/Core/Src/Core.cpp b/Source/Core/Core/Src/Core.cpp index e60cedeed8..4119c4db1e 100644 --- a/Source/Core/Core/Src/Core.cpp +++ b/Source/Core/Core/Src/Core.cpp @@ -17,7 +17,11 @@ #ifdef _WIN32 - #include <windows.h> +#include <windows.h> +#endif + +#ifdef __APPLE__ +#import <Foundation/NSAutoreleasePool.h> #endif #include "Setup.h" // Common @@ -261,6 +265,10 @@ void Stop() // - Hammertime! THREAD_RETURN CpuThread(void *pArg) { +#ifdef __APPLE__ + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; +#endif + CPluginManager &Plugins = CPluginManager::GetInstance(); const SCoreStartupParameter& _CoreParameter = SConfig::GetInstance().m_LocalCoreStartupParameter; @@ -298,6 +306,10 @@ THREAD_RETURN CpuThread(void *pArg) } cpuRunloopQuit.Set(); + +#ifdef __APPLE__ + [pool release]; +#endif return 0; } @@ -306,6 +318,10 @@ THREAD_RETURN CpuThread(void *pArg) // Call browser: Init():g_EmuThread(). See the BootManager.cpp file description for a complete call schedule. THREAD_RETURN EmuThread(void *pArg) { +#ifdef __APPLE__ + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; +#endif + Host_UpdateMainFrame(); // Disable any menus or buttons at boot cpuRunloopQuit.Init(); @@ -522,6 +538,10 @@ THREAD_RETURN EmuThread(void *pArg) cpuRunloopQuit.Shutdown(); g_bStopping = false; + +#ifdef __APPLE__ + [pool release]; +#endif return 0; } |
