From 660ebf2c6cf2796bec39242ed0ea8dc13d65421e Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 9 Nov 2014 16:53:25 +0200 Subject: [PATCH] Added auto-release pools to decrease memory fragmentation on older OS X like 10.5 or 10.6 --- src/cocoa/i_backend_cocoa.mm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/cocoa/i_backend_cocoa.mm b/src/cocoa/i_backend_cocoa.mm index dd376efb8..089d07f0d 100644 --- a/src/cocoa/i_backend_cocoa.mm +++ b/src/cocoa/i_backend_cocoa.mm @@ -1378,7 +1378,9 @@ static ApplicationController* appCtrl; - (void)processEvents:(NSTimer*)timer { ZD_UNUSED(timer); - + + NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; + while (true) { NSEvent* event = [NSApp nextEventMatchingMask:NSAnyEventMask @@ -1435,6 +1437,8 @@ static ApplicationController* appCtrl; } [NSApp updateWindows]; + + [pool release]; } @@ -1513,6 +1517,8 @@ void I_SetMainWindowVisible(bool visible) bool I_SetCursor(FTexture* cursorpic) { + NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; + if (NULL == cursorpic || FTexture::TEX_Null == cursorpic->UseType) { s_cursor = [NSCursor arrowCursor]; @@ -1567,7 +1573,9 @@ bool I_SetCursor(FTexture* cursorpic) } [appCtrl invalidateCursorRects]; - + + [pool release]; + return true; }