summaryrefslogtreecommitdiffhomepage
path: root/objective-c.html.markdown
diff options
context:
space:
mode:
authorLevi Bostian <levi.bostian@gmail.com>2014-01-01 19:01:50 -0600
committerLevi Bostian <levi.bostian@gmail.com>2014-01-01 19:01:50 -0600
commitfff847f09e67144a67ec6e0db2198273ef8d91ad (patch)
tree9444a890e248cab454027726918dd9bb7d9f8942 /objective-c.html.markdown
parente4db90a2f9d56fdda3cc367cbd618dd719ce3f53 (diff)
Add @autoreleasepool as alternative to NSAutoreleasePool object.
Diffstat (limited to 'objective-c.html.markdown')
-rw-r--r--objective-c.html.markdown7
1 files changed, 6 insertions, 1 deletions
diff --git a/objective-c.html.markdown b/objective-c.html.markdown
index 406b2e92..b9460127 100644
--- a/objective-c.html.markdown
+++ b/objective-c.html.markdown
@@ -28,7 +28,9 @@ int main (int argc, const char * argv[])
{
// Create an autorelease pool to manage the memory into the program
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
-
+ // If using automatic reference counting (ARC), use @autoreleasepool instead:
+ @autoreleasepool {
+
// Use NSLog to print lines to the console
NSLog(@"Hello World!"); // Print the string "Hello World!"
@@ -267,6 +269,9 @@ int main (int argc, const char * argv[])
// Clean up the memory you used into your program
[pool drain];
+
+ // End of @autoreleasepool.
+ }
// End the program
return 0;