Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Memory Management

Memory Management

Lightening talk done at NSLondon about Memory Management. Covering many of the common mistakes people have with memory management using ARC and how to avoid. Briefly covering the runtime support for ARC.

Related blog post: http://kylefuller.co.uk/posts/memory-management-arc/

Kyle Fuller

October 24, 2013
Tweet

More Decks by Kyle Fuller

Other Decks in Programming

Transcript

  1. dispatch_block_t block = ^{ NSLog(@"Hello World!"); }; ! NSArray *blocks

    = [[NSArray alloc] initWithObject:[block copy]];
  2. - (void)startOperation { NSOperation *operation = [[NSOperation alloc] init]; !

    [operation setCompletionBlock:^{ NSLog(@"Completion for %@", operation); }]; }
  3. - (void)startOperation { NSOperation *operation = [[NSOperation alloc] init]; __weak

    NSOperation *weakOperation = operation; ! [operation setCompletionBlock:^{ NSLog(@"Completion for %@", weakOperation); }]; }