NSmutable memory issues for iphone -


I'm using it a1 = [[NSMutableArray alloc] init]; Now should be the best way to release a1

I am currently releasing in dealloc ()

I see allocation in viewdidload

This will be a basic example: <1; / P> // Party started NSMutableArray * tmpArray = [[NSMutableArray alloc] init]; // As an example, just copy some user errors into temporary array tmpArray = [[userDefaults objectForKey: @ "UserDefaultsExample"] mutableCopy]; // do something here with tmpArray (i.e. if ([tmpArray count] == ​​0) // something) // Once done with tmpArray, then go ahead and release it [tmpArray release];

For your case, once you want to release the array after it's expired (i.e. the end of viewDidLoad is probably a long-term safe bet as That you are actually ending with it). If you do this, you do not need to create an NSMutableArray object in your .h file, synthesize it and release it in DLOK. Instead, you just make a temporary one like I did it up and release it when you show images from it.


Comments