- Using of @autoreleasepool is better ios-revival
authorAnton Malmygin <antonc27@mail.ru>
Tue, 18 Aug 2015 01:08:21 +0200
branchios-revival
changeset 11137 14f50dde3e8c
parent 11136 9b5f60bc059e
child 11138 05853b1df2a2
- Using of @autoreleasepool is better
project_files/HedgewarsMobile/Classes/Appirater.m
project_files/HedgewarsMobile/Classes/EngineProtocolNetwork.m
project_files/HedgewarsMobile/Classes/GameConfigViewController.m
project_files/HedgewarsMobile/Classes/MXAudioPlayerFadeOperation.m
project_files/HedgewarsMobile/Classes/MapPreviewButtonView.m
project_files/HedgewarsMobile/Classes/ServerProtocolNetwork.m
--- a/project_files/HedgewarsMobile/Classes/Appirater.m	Tue Aug 18 00:51:23 2015 +0200
+++ b/project_files/HedgewarsMobile/Classes/Appirater.m	Tue Aug 18 01:08:21 2015 +0200
@@ -47,7 +47,7 @@
 }
 
 -(void) appLaunchedHandler {
-    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+    @autoreleasepool {
 
     if (APPIRATER_DEBUG) {
         [self performSelectorOnMainThread:@selector(showPrompt) withObject:nil waitUntilDone:NO];
@@ -116,7 +116,7 @@
     if (!willShowPrompt)
         [self autorelease];
 
-    [pool release];
+    }
 }
 
 -(void) showPrompt {
--- a/project_files/HedgewarsMobile/Classes/EngineProtocolNetwork.m	Tue Aug 18 00:51:23 2015 +0200
+++ b/project_files/HedgewarsMobile/Classes/EngineProtocolNetwork.m	Tue Aug 18 01:08:21 2015 +0200
@@ -214,7 +214,8 @@
 
 // this is launched as thread and handles all IPC with engine
 -(void) engineProtocol:(id) object {
-    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+    @autoreleasepool {
+    
     NSDictionary *gameConfig = (NSDictionary *)object;
     NSMutableArray *statsArray = nil;
     TCPsocket sd;
@@ -403,8 +404,9 @@
     [HWUtils freePort:self.enginePort];
     SDLNet_TCP_Close(csd);
     SDLNet_Quit();
+    
+    }
 
-    [pool release];
     // Invoking this method should be avoided as it does not give your thread a chance
     // to clean up any resources it allocated during its execution.
     //[NSThread exit];
--- a/project_files/HedgewarsMobile/Classes/GameConfigViewController.m	Tue Aug 18 00:51:23 2015 +0200
+++ b/project_files/HedgewarsMobile/Classes/GameConfigViewController.m	Tue Aug 18 01:08:21 2015 +0200
@@ -230,7 +230,8 @@
 }
 
 -(void) loadNiceHogs {
-    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+    @autoreleasepool {
+    
     srand(time(NULL));
     NSString *filePath = [[NSString alloc] initWithFormat:@"%@/Hedgehog/Idle.png",GRAPHICS_DIRECTORY()];
     UIImage *hogSprite = [[UIImage alloc] initWithContentsOfFile:filePath];
@@ -284,7 +285,8 @@
 
     [self.view addSubview:self.imgContainer];
     [hogSprite release];
-    [pool drain];
+        
+    }
 }
 
 -(void) viewDidLoad {
--- a/project_files/HedgewarsMobile/Classes/MXAudioPlayerFadeOperation.m	Tue Aug 18 00:51:23 2015 +0200
+++ b/project_files/HedgewarsMobile/Classes/MXAudioPlayerFadeOperation.m	Tue Aug 18 01:08:21 2015 +0200
@@ -79,7 +79,8 @@
 }
 
 - (void)main {
-  NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+  @autoreleasepool {
+
   [NSThread sleepForTimeInterval:_delay];
   if ([self.audioPlayer isKindOfClass:[AVAudioPlayer class]]) {
     [self beginFadeOperation];
@@ -88,7 +89,7 @@
     ALog(@"AudioPlayerFadeOperation began with invalid AVAudioPlayer");
   }
 
-  [pool release];
+  }
 }
 
 - (void)beginFadeOperation {
--- a/project_files/HedgewarsMobile/Classes/MapPreviewButtonView.m	Tue Aug 18 00:51:23 2015 +0200
+++ b/project_files/HedgewarsMobile/Classes/MapPreviewButtonView.m	Tue Aug 18 01:08:21 2015 +0200
@@ -151,7 +151,8 @@
 }
 
 -(void) drawingThread {
-    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+    @autoreleasepool {
+    
     uint8_t unpackedMap[128*32*8];
     [self engineProtocol:unpackedMap];
 
@@ -179,8 +180,8 @@
     [self performSelectorOnMainThread:@selector(removeIndicator)
                            withObject:nil
                         waitUntilDone:NO];
-
-    [pool release];
+    
+    }
 }
 
 -(void) updatePreviewWithSeed:(NSString *)seed {
--- a/project_files/HedgewarsMobile/Classes/ServerProtocolNetwork.m	Tue Aug 18 00:51:23 2015 +0200
+++ b/project_files/HedgewarsMobile/Classes/ServerProtocolNetwork.m	Tue Aug 18 01:08:21 2015 +0200
@@ -82,7 +82,8 @@
 }
 
 -(void) serverProtocol {
-    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+    @autoreleasepool {
+    
     IPaddress ip;
     BOOL clientQuit = NO;
     char *buffer = (char *)malloc(sizeof(char)*BUFFER_SIZE);
@@ -206,7 +207,7 @@
     SDLNet_TCP_Close(self.ssd);
     SDLNet_Quit();
 
-    [pool release];
+    }
 }
 
 @end