Skip to content

Commit 21bf1c3

Browse files
committed
Drain NSAutoreleasePools instead of releasing them.
Releasing objects is a no-op in garbage collected environments, so draining them is the preferred method.
1 parent 8422fae commit 21bf1c3

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

RunLoop/AsyncSocket.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4291,7 +4291,7 @@ static void MyCFSocketCallback (CFSocketRef sref, CFSocketCallBackType type, CFD
42914291
AsyncSocket *theSocket = [[(AsyncSocket *)pInfo retain] autorelease];
42924292
[theSocket doCFSocketCallback:type forSocket:sref withAddress:(NSData *)address withData:pData];
42934293

4294-
[pool release];
4294+
[pool drain];
42954295
}
42964296

42974297
/**
@@ -4305,7 +4305,7 @@ static void MyCFReadStreamCallback (CFReadStreamRef stream, CFStreamEventType ty
43054305
AsyncSocket *theSocket = [[(AsyncSocket *)pInfo retain] autorelease];
43064306
[theSocket doCFReadStreamCallback:type forStream:stream];
43074307

4308-
[pool release];
4308+
[pool drain];
43094309
}
43104310

43114311
/**
@@ -4319,7 +4319,7 @@ static void MyCFWriteStreamCallback (CFWriteStreamRef stream, CFStreamEventType
43194319
AsyncSocket *theSocket = [[(AsyncSocket *)pInfo retain] autorelease];
43204320
[theSocket doCFWriteStreamCallback:type forStream:stream];
43214321

4322-
[pool release];
4322+
[pool drain];
43234323
}
43244324

43254325
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

RunLoop/AsyncUdpSocket.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2337,7 +2337,7 @@ static void MyCFSocketCallback(CFSocketRef sref, CFSocketCallBackType type, CFDa
23372337
AsyncUdpSocket *theSocket = [[(AsyncUdpSocket *)pInfo retain] autorelease];
23382338
[theSocket doCFSocketCallback:type forSocket:sref withAddress:(NSData *)address withData:pData];
23392339

2340-
[pool release];
2340+
[pool drain];
23412341
}
23422342

23432343
@end

0 commit comments

Comments
 (0)