Questions tagged [manual-retain-release]

Manual Retain Release (as opposed to ARC) is the classic way to manage object lifetime in Objective-C.

As the overwhelming majority of projects use ARC nowadays, MRR is an important specific difference of code that still uses this style. Even though it appears as a characteristic of legacy code, it is the foundation on which ARC builds upon. To understand the sources of some bugs or performance problems it is vital to understand these underpinnings.

References:

21 questions
0
votes
1 answer

IOS Release and assignment messages differences for nsstring

I was going through the memory management concepts. I created one string1 and assign that string1 into another string2, now I release this string1. Here string2 retain count is 1 but on NSLog statement it gives EXC Bad access. When I am assigning…
Gypsa
  • 11,230
  • 6
  • 44
  • 82
0
votes
3 answers

Need to release twice?

I can't seem to find the answer anywhere. I'm using Manual Memory Management in Objective-C developing for iOS. I wrote a convenience function for getting UIColor from a hex string. In it, it returns [[UIColor alloc] initWithRed:...…
0
votes
2 answers

Reference Count or Retain Count Issue (Memory Management)

The below code works fine, you can run it at your system for confirmation. My question is, as you can see, the dealloc method is only called when the retain count reaches zero, meaning the memory is freed for the RetainTracker object. However, the…
Amit Thakur
  • 1,081
  • 12
  • 14
-1
votes
1 answer

deinit() ceases to call when this code line of code executes

Recently I have been reviewing my code and noticed in one of my view controllers, deinit() is not called. After commenting out this line, deinit calls successfully: NotificationCenter.default.addObserver(forName: .UIKeyboardWillShow, object: nil,…
NullHypothesis
  • 4,286
  • 6
  • 37
  • 79
-1
votes
3 answers

App crashes in iOS7 but not in 8 &9 due to NSDictionary autorelease

+ (NSString *)getValueforLocale:(NSString*) i18nkey :(NSString*)locale{ NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES); NSLog(@"paths are : %@",paths); NSString *libraryDirectory = [paths…
-1
votes
1 answer

NSDate throwing BAD_EXCESS for what?

I have below. @interface MyViewController () { NSDate *myCurrentDate; } @implementation MyViewController -(void)viewDidLoad { [super viewDidLoad]; myCurrentDate = [NSDate date]; } - (IBAction) prevAction:(id)sender { …
Fahim Parkar
  • 30,974
  • 45
  • 160
  • 276
1
2