Questions tagged [automatic-ref-counting]

Automatic Reference Counting (ARC) is a compiler feature that provides automatic memory management of Objective-C and Swift objects.

Automatic Reference Counting (ARC) is a technology introduced in LLVM 3.0 (which ships with Xcode 4.2) for managing memory in Objective-C. Swift also uses ARC. This method removes the need for much of the code previously required for manual memory management (MRR) of objects in Objective-C (such as manually calling release) and introduces new memory management qualifiers (namely strong and weak). ARC is a compile-time feature that transparently incorporates the appropriate reference-counting memory management calls into the final application. Like manual reference counting, there is no run-time garbage collection.

References:

See Also

  • For the Arc programming language, see arc-lisp.
3809 questions
2
votes
1 answer

Memory warning when assigning new value to __autoreleasing inout parameter incorporating old value under ARC

I am implementing key-value validation like so: - (BOOL)validateValue:(__autoreleasing id *)value forKey:(NSString *)key error:(NSError *__autoreleasing *)error { NSAttributeDescription *attribute = [[self.entity attributesByName]…
jamesmoschou
  • 1,173
  • 8
  • 15
2
votes
2 answers

How to autorelease a non returned object under ARC

Consider a function like this one: void* getData() { void* data= malloc(32); NSData* __autoreleasing dataObject= [NSData dataWithBytesNoCopy: data length: 32 freeWhenDone: YES] return data; } If I try to execute this code and print…
2
votes
0 answers

Error Message Using Facebook Deprecated Headers

I have an application in Xcode 4.5 which integrates Facebook. I am using ARC. The application uses native dialogs and therefore deprecated headers (ie Facebook.h). Apparently doing so leads to the following error when closing/cleaning the active…
jac300
  • 5,182
  • 14
  • 54
  • 89
2
votes
1 answer

What does it mean when a variable is both __block and __weak in ARC?

I understand that __block in ARC retains the variable. This can then be used when accessing a variable within a block before the variable has been assigned, as in: __block __weak id observer = [[NSNotificationCenter defaultCenter]…
Aaron
  • 619
  • 6
  • 15
2
votes
4 answers

Why inline assembly doesn't work with ARC in Xcode?

I am really confused with this subject. I am using LLVM 4.1 compiler on Xcode and when I compile a simple basic code like this in 32 bit or x64 or x64-x86 mode with ARC off, everything is ok but if I compile with Automatic Reference Counting mode;…
Aug
  • 595
  • 9
  • 22
2
votes
1 answer

Xcode suggests to replace %C with %d

Possible Duplicate: Format specifies type ‘unsigned short’ but the argument has type ‘int’ I am using the NSString Html category at https://github.com/mwaterfall/MWFeedParser/blob/master/Classes/NSString%2BHTML.m Xcode gives me this…
shaikh
  • 1,355
  • 4
  • 16
  • 30
2
votes
3 answers

Instruments Memory Leak With ARC Confusion

Good morning, I was doing some fine tuning on this application I've been working on, just to make sure everything was running smooth and no memory leaks happened. So I ran my app with Instruments and I selected the allocations and leaks tool. My app…
2
votes
2 answers

What is the value in learning manual retain/release? (iOS)

Possible Duplicate: To ARC or not to ARC? What are the pros and cons? I'm just getting started with Objective-C and iOS development. It seems that Automatic Reference Counting (ARC) is now (and has been for some time) the preferred way to handle…
ericsoco
  • 24,913
  • 29
  • 97
  • 127
2
votes
1 answer

ARC + NSLocalizedString + NSMenuItem#title == Memory Issue

I'm using ARC and generic Cocoa and still hitting memory issues. With NSZombiesEnabled, the following line points to the crash: [self.menu itemWithTag:MYMenuItemStatus].title = NSLocalizedString(@"DISCONNECTED", nil); With the error: *** -[CFString…
2
votes
1 answer

Warning: Capturing $XXX strongly in this block is likely to lead to a retain cycle in 'AFHTTPClient.m'

I use AFNetworking in my project,but it have 2 warnings here: full warning string is: /AFNetworking/AFHTTPClient.m:575:38: Capturing 'operation' strongly in this block is likely to lead to a retain cycle
yellow
  • 702
  • 1
  • 10
  • 24
2
votes
1 answer

Calling ObjC functions in C++11 context

I have a C++ class in my Objective C ARC project. The class is derived from a pure C++ class and adds a platform specific implementation for my iOS project. I want to call Objective C functions and frameworks there. I implemented the platform…
2
votes
2 answers

Set a new value to a NSString variable with a previous value

I'm developing an iOS application with latest SDK and XCode. This is a simple question but I don't know how to do it because I don't want any memory leaks on my code. I'm using ARC on my project and I have the following header…
VansFannel
  • 45,055
  • 107
  • 359
  • 626
2
votes
0 answers

Using objc_retain with struct object when using ARC

When using ARC I will sometimes mark individual files to not use ARC so I can use C struct's with object fields. Instead of doing this I have been thinking recently of declaring the struct object fields as __unsafe_retained and then using the…
Nathan Day
  • 5,981
  • 2
  • 24
  • 40
2
votes
3 answers

Objective-c object inside a typedef struct (forbidden in ARC)

I am new to Objective-C programming and Xcode. I inherited an old version (3.2.5) of a project, and I recently converted it to the newest version (4.5.2). I converted this project to ARC, and I am having issues with an objective-c object found…
user1873837
  • 23
  • 1
  • 4
2
votes
2 answers

ARC convert for before iOS 5 SDK

i have already developed a project upto iOS 4 compatible. my question is now i want non-ARC to ARC enable project which should work on lates iOS 6 version.
korat prashant
  • 1,523
  • 10
  • 24
1 2 3
99
100