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
1357
votes
18 answers

How can I disable ARC for a single file in a project?

I am using ARC successfully in my project. However, I have encountered a few files (e.g., in unit tests and mock objects) where the rules of ARC are a little more fragile right now. I recall hearing that there was a way to disable ARC on a per-file…
casademora
  • 60,192
  • 15
  • 66
  • 77
5
votes
1 answer

Enabling in ARC in xamarin

Most of the security and penetration tools report if the ARC is not enabled. fobjc-arc flag is not Found As far as I know we can't do this in xamarin because we don't have build settings here. This flag can be set in build settings only. Even if…
3
votes
4 answers

How can I safely go between ARC and MRC methods without unnecessary retain/release calls?

I have an ARC class with the following code: [object doStuffWithObject:otherObject]; object's -doStuffWithObject: method is compiled with ARC, and is this: - (void)doStuffWithObject:(id)otherObject { DoStuffHelper(object,…
meisel
  • 1,783
  • 2
  • 17
  • 30
2
votes
0 answers

Protobuf missing 'list' suffix in Objective-C generated code

I'm using protobuf 2.6.1 with this plugin which I compiled myself. In the project I'm working with Protobuf models are already present. I tried to regenerate the files using the following command: protoc…
1
vote
2 answers

Deinit not calling - Cannot find why something is retaining (code provided)

I have discovered that my UIViewcontroller is not calling deinit() under the following scenario. I am using this code extension to make my life easier by adding tap gesture…
NullHypothesis
  • 3,808
  • 3
  • 28
  • 72
1
vote
0 answers

Swift: How ARC deals with anonymous objects?

ARC came many years ago to replace painful MRC, but since ARC is only a compiler technique its magic happens during the compile time. So, basically what it does - automatically inserts retain and release calls where appropriate. So, now comes my…
1
vote
1 answer

iOS: What is the difference in ARC and MRC when an object is set to nil?

In MRC in iOS, when an object is set to nil, myObject = nil; It's told that memory leak will happen, as the myObject will not point to a memory address. The memory which it was pointing before will be lost. So we need to release the myObject and…
1
vote
1 answer

NSStringto class member assignation crashes

I am working on C++ and objective-c++ application. There I have C++ class which calls Objective-c++ class. In c++ header I am creating void* like this: void *m_self; Then in constructor I instantiate objective-c++ like this: m_self = [[InfoForMac…
1
vote
0 answers

How to disable ARC for some files for ALL targets in a project?

I checked that ticket that works well (adding in compile source by tapping on Enter on keyboard and adding "-fno-objc-arc"), but my problem is that I have next to 80 targets in my projects. I would like to know if there is a way to exclude the…
ΩlostA
  • 2,152
  • 4
  • 19
  • 47
1
vote
4 answers

Is there a quick rule to know when to release Objective-C variables?

Are there any rules of thumb when working with Objective-C that would help me understand when is the right time to release variables?
0
votes
1 answer

NSOutlineView crash on Mac OS versions below 10.12 as 'stronglyReferencesItems' set to 'false' by default

My app has an outline view which get frequent updates from server. Whenever I get an update I reload outline view. I do multiple operation with outline at the same time like showing some buttons on mouse over, expand/collapse items. For these…
prabhu
  • 1,008
  • 1
  • 10
  • 26
0
votes
1 answer

Returning a `CGEvent` of my own creation in `NSEventTap`

Documentation for CGEventTapCallBack here states: CGEventRef event The incoming event. This event is owned by the caller, and you do not need to release it. What happens if I wish to eat the event, and return NULL? Should I CFRelease…
P i
  • 25,182
  • 33
  • 133
  • 229
0
votes
1 answer

How to reproduce a rare "_CFAutoReleasePoolPop" crash?

I am trying to reproduce such crash(es): There's Manual Reference Counting in my project. Also, there's a lot of multi-threading. Some of the properties are not thread-safe. :( I have just one assumption about the cause of this crash: some object…
0
votes
2 answers

Misaligned pointer use with std::shared_ptr dereference

I am working in a legacy codebase with a large amount of Objective-C++ written using manual retain/release. Memory is managed using lots of C++ std::shared_ptr, with a suitable deleter passed in on construction that calls…
0
votes
1 answer

Objective-C object are not destroyed after release message

I was confused by such output result of this program. #import #import "Human.h" int main(int argc, const char * argv[]) { Human *human = [Human new]; [human release]; [human sayHello]; return 0; } The…
Dave
  • 5
  • 2
1
2