SlideShare uma empresa Scribd logo
1 de 46
Baixar para ler offline
ARC of a Developer Part.1




11   11   22
Automatic Referrence Counting

          • Objective-C


          •               -


          •                    - retain release


          •           - weak              weak referrence




11   11   22
•

          •

               • EXC_BAD_ACCESS



          •2       release

               • NSZombie



          •

          •



11   11   22
ARC

          • GC


          •


               • retain/release 2.5


               • autoreleasepool 6


               • objc_msgSend 33%




11   11   22
ARC

          •




11   11   22
ARC

          •           ARC


          • LLVM3.0




          •            -fobjc-arc




11   11   22
•    -fno-objc-arc




11   11   22
• iOS4      weak reference


               • __unsafe_unretained


          • weak reference




11   11   22
• __strong


          • __weak


          • __unsafe_unretained


          • __autoreleasing




          •




11   11   22
Before ARC

          •


          •    autorelease


          •




11   11   22
•


               • VB6


               • COM


               • Objective-C


               •


          • JAVA .NET          Obj-C   GC




11   11   22
• NSObject *obj = [[NSObject alloc]init];




                     * obj

                                                      NSObject

                                                         1


11   11   22
• NSObject *obj = [[NSObject alloc]init];


          • NSObject *obj2 = [obj retain];

                     * obj

                                                      NSObject

                                                         2
                    * obj2




11   11   22
• NSObject *obj = [[NSObject alloc]init];


          • NSObject *obj2 = [obj retain];


          • [obj release];

                                                      NSObject

                                                         1
                     * obj2




11   11   22
• NSObject *obj = [[NSObject alloc]init];


          • NSObject *obj2 = [obj retain];


          • [obj release];


          • [obj2 release];                           NSObject

                                                         0


11   11   22
Autorelease

          •

               +(id)array{
                   NSMutableArray *array = [[[NSMutableArray alloc]init]autorelease];
                   return array;
               }




                        * array

                                                                NSArray

                                                                     1

11   11   22
Autorelease

          •

               +(id)array{
                   NSMutableArray *array = [[[NSMutableArray alloc]init]autorelease];
                   return array;
               }




                        * array

                                                                NSArray

                       release                                       1
                 autorelease pool

11   11   22
Autorelease

          •

               +(id)array{
                   NSMutableArray *array = [[[NSMutableArray alloc]init]autorelease];
                   return array;
               }




                                                                NSArray

                       release                                       1
                 autorelease pool

11   11   22
Autorelease

          •

               +(id)array{
                   NSMutableArray *array = [[[NSMutableArray alloc]init]autorelease];
                   return array;
               }




                                                                NSArray

                                                                     0

11   11   22
Retain Release Autorerelease

          •


          •




11   11   22
11   11   22
•


               •




11   11   22
Xcode Static Analyzer

          • Xcode   Analyze


          •




11   11   22
ARC

          •


          •    Retain   Release




11   11   22
• __strong


          • __weak


          • __unsafe_unretained


          • __autoreleasing




11   11   22
nil

          •                     nil


               • id __strong obj1;


               • id __strong obj1 = nil;




11   11   22
__strong

          •


          • id


               • id test = [[NSObject alloc]init];


               • id __strong test = [[NSObject alloc]init];


          •      retain release


          •                          strong




11   11   22
__strong

          • dealloc   release


               •                           release


               •                          Retain


               •                Release




11   11   22
__strong

                                         +1                    +1
               {
                    NSMutableArray *array = [[NSMutableArray alloc]init];

                    [array   addObject:[[NSObject   alloc]init]];
                    [array   addObject:[[NSObject   alloc]init]];
                    [array   addObject:[[NSObject   alloc]init]];
                    [array   addObject:[[NSObject   alloc]init]];
               }

          • array                            +1


          •                    array                  -1




11   11   22
Retain
           {
                   NSMutableArray *array = [[NSMutableArray alloc]init];

                   [array   addObject:[[NSObject   alloc]init]];
                   [array   addObject:[[NSObject   alloc]init]];
                   [array   addObject:[[NSObject   alloc]init]];
                   [array   addObject:[[NSObject   alloc]init]];
           }

               @property (nonatomic,retain) NSMutableArray *array;

               {
                   self.array = [[[NSMutableArray alloc]init]autorelease];

                   [array   addObject:[[[NSObject   alloc]init]autorelease]];
                   [array   addObject:[[[NSObject   alloc]init]autorelease]];
                   [array   addObject:[[[NSObject   alloc]init]autorelease]];
                   [array   addObject:[[[NSObject   alloc]init]autorelease]];
               }


11   11   22
Autorelease

          • Relase



                                           +1                    +1
               {
                     NSMutableArray *array = [[NSMutableArray alloc]init];

                     [array   addObject:[[NSObject   alloc]init]];
                     [array   addObject:[[NSObject   alloc]init]];
                     [array   addObject:[[NSObject   alloc]init]];
                     [array   addObject:[[NSObject   alloc]init]];
               }




11   11   22
•       autorelease


          •                                                 autorelease pool




               +(id)array{
                   id obj = [[NSMutableArray alloc]init];
                   return obj;
               }




11   11   22
assign         __unsafe_unretained

                     copy               __strong

                    retain              __strong

                    strong              __strong

               unsafe_unretained   __unsafe_unretained

                     weak               __weak


11   11   22
strong

          •        release retain


               •




11   11   22
11   11   22
•




               A

                   B   C

                   E   D
11   11   22
A

                   B   C

                   E   D
11   11   22
A

                        B   C
               assign
                        E   D
11   11   22
@interface Test : NSObject{
                   id childObject;
               }
               -(void)setObject:(id)child;

               @end



               {
                   id test1 = [[Test alloc]init];
                   id test2 = [[Test alloc]init];

                   [test1 setObject:test2];
                   [test2 setObject:test1];
               }




11   11   22
{
               id test1 = [[Test alloc]init];
               id test2 = [[Test alloc]init];

               [test1 setObject:test2];
               [test2 setObject:test1];
     }




                        test1                   test2

                       test1                    test2
11   11   22
__weak

          • Retain

               @interface Test : NSObject{
                   id __weak childObject;
               }
               -(void)setObject:(id)child;

               @end




                      test1                  test2

11   11   22
__weak

          •            nil


          •




               test1   test2

11   11   22
__weak


                                         +1

                   id __weak obj = [[NSObject alloc]init];




          •                   delegate




11   11   22
autorelease pool

          •


          •              Thread
              NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init];

              //

              [pool drain];


               @autoreleasepool {
                   //
               }


          • LLVM3.0           ARC

11   11   22
•




11   11   22
11   11   22

Mais conteúdo relacionado

Mais procurados

Java Concurrency Gotchas
Java Concurrency GotchasJava Concurrency Gotchas
Java Concurrency GotchasAlex Miller
 
The Ring programming language version 1.10 book - Part 104 of 212
The Ring programming language version 1.10 book - Part 104 of 212The Ring programming language version 1.10 book - Part 104 of 212
The Ring programming language version 1.10 book - Part 104 of 212Mahmoud Samir Fayed
 
Ow2 Utilities, OW2con'12, Paris
Ow2 Utilities, OW2con'12, ParisOw2 Utilities, OW2con'12, Paris
Ow2 Utilities, OW2con'12, ParisOW2
 
Mastering Java Bytecode With ASM - 33rd degree, 2012
Mastering Java Bytecode With ASM - 33rd degree, 2012Mastering Java Bytecode With ASM - 33rd degree, 2012
Mastering Java Bytecode With ASM - 33rd degree, 2012Anton Arhipov
 
Snapshot Testing @ CocoaheadsNL
Snapshot Testing @ CocoaheadsNLSnapshot Testing @ CocoaheadsNL
Snapshot Testing @ CocoaheadsNLLars Lockefeer
 
Øredev 2011 - JVM JIT for Dummies (What the JVM Does With Your Bytecode When ...
Øredev 2011 - JVM JIT for Dummies (What the JVM Does With Your Bytecode When ...Øredev 2011 - JVM JIT for Dummies (What the JVM Does With Your Bytecode When ...
Øredev 2011 - JVM JIT for Dummies (What the JVM Does With Your Bytecode When ...Charles Nutter
 
Ow2 Utilities - The Swiss Army Knife Of Ow2 Projects
Ow2 Utilities - The Swiss Army Knife Of Ow2 ProjectsOw2 Utilities - The Swiss Army Knife Of Ow2 Projects
Ow2 Utilities - The Swiss Army Knife Of Ow2 ProjectsGuillaume Sauthier
 
Hacking JavaFX with Groovy, Clojure, Scala, and Visage: Stephen Chin
Hacking JavaFX with Groovy, Clojure, Scala, and Visage: Stephen ChinHacking JavaFX with Groovy, Clojure, Scala, and Visage: Stephen Chin
Hacking JavaFX with Groovy, Clojure, Scala, and Visage: Stephen Chinjaxconf
 
Building node.js applications with Database Jones
Building node.js applications with Database JonesBuilding node.js applications with Database Jones
Building node.js applications with Database JonesJohn David Duncan
 
Locks (Concurrency)
Locks (Concurrency)Locks (Concurrency)
Locks (Concurrency)Sri Prasanna
 
Making Java more dynamic: runtime code generation for the JVM
Making Java more dynamic: runtime code generation for the JVMMaking Java more dynamic: runtime code generation for the JVM
Making Java more dynamic: runtime code generation for the JVMRafael Winterhalter
 
2013 gr8 conf_grails_code_from_the_trenches
2013 gr8 conf_grails_code_from_the_trenches2013 gr8 conf_grails_code_from_the_trenches
2013 gr8 conf_grails_code_from_the_trenchesEdwin van Nes
 
Construire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleConstruire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleThierry Wasylczenko
 
Terence Barr - jdk7+8 - 24mai2011
Terence Barr - jdk7+8 - 24mai2011Terence Barr - jdk7+8 - 24mai2011
Terence Barr - jdk7+8 - 24mai2011Agora Group
 
Execution model and other must-know's
Execution model and other must-know'sExecution model and other must-know's
Execution model and other must-know'sPablo Enfedaque
 

Mais procurados (20)

Java Concurrency Gotchas
Java Concurrency GotchasJava Concurrency Gotchas
Java Concurrency Gotchas
 
The Ring programming language version 1.10 book - Part 104 of 212
The Ring programming language version 1.10 book - Part 104 of 212The Ring programming language version 1.10 book - Part 104 of 212
The Ring programming language version 1.10 book - Part 104 of 212
 
Ow2 Utilities, OW2con'12, Paris
Ow2 Utilities, OW2con'12, ParisOw2 Utilities, OW2con'12, Paris
Ow2 Utilities, OW2con'12, Paris
 
Mastering Java Bytecode With ASM - 33rd degree, 2012
Mastering Java Bytecode With ASM - 33rd degree, 2012Mastering Java Bytecode With ASM - 33rd degree, 2012
Mastering Java Bytecode With ASM - 33rd degree, 2012
 
Snapshot Testing @ CocoaheadsNL
Snapshot Testing @ CocoaheadsNLSnapshot Testing @ CocoaheadsNL
Snapshot Testing @ CocoaheadsNL
 
JDK Power Tools
JDK Power ToolsJDK Power Tools
JDK Power Tools
 
Øredev 2011 - JVM JIT for Dummies (What the JVM Does With Your Bytecode When ...
Øredev 2011 - JVM JIT for Dummies (What the JVM Does With Your Bytecode When ...Øredev 2011 - JVM JIT for Dummies (What the JVM Does With Your Bytecode When ...
Øredev 2011 - JVM JIT for Dummies (What the JVM Does With Your Bytecode When ...
 
Ow2 Utilities - The Swiss Army Knife Of Ow2 Projects
Ow2 Utilities - The Swiss Army Knife Of Ow2 ProjectsOw2 Utilities - The Swiss Army Knife Of Ow2 Projects
Ow2 Utilities - The Swiss Army Knife Of Ow2 Projects
 
Hacking JavaFX with Groovy, Clojure, Scala, and Visage: Stephen Chin
Hacking JavaFX with Groovy, Clojure, Scala, and Visage: Stephen ChinHacking JavaFX with Groovy, Clojure, Scala, and Visage: Stephen Chin
Hacking JavaFX with Groovy, Clojure, Scala, and Visage: Stephen Chin
 
Building node.js applications with Database Jones
Building node.js applications with Database JonesBuilding node.js applications with Database Jones
Building node.js applications with Database Jones
 
Locks (Concurrency)
Locks (Concurrency)Locks (Concurrency)
Locks (Concurrency)
 
Lecture 3-ARC
Lecture 3-ARCLecture 3-ARC
Lecture 3-ARC
 
Testing (eng)
Testing (eng)Testing (eng)
Testing (eng)
 
Making Java more dynamic: runtime code generation for the JVM
Making Java more dynamic: runtime code generation for the JVMMaking Java more dynamic: runtime code generation for the JVM
Making Java more dynamic: runtime code generation for the JVM
 
2013 gr8 conf_grails_code_from_the_trenches
2013 gr8 conf_grails_code_from_the_trenches2013 gr8 conf_grails_code_from_the_trenches
2013 gr8 conf_grails_code_from_the_trenches
 
#JavaFX.forReal() - ElsassJUG
#JavaFX.forReal() - ElsassJUG#JavaFX.forReal() - ElsassJUG
#JavaFX.forReal() - ElsassJUG
 
02 - Basics of Qt
02 - Basics of Qt02 - Basics of Qt
02 - Basics of Qt
 
Construire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleConstruire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradle
 
Terence Barr - jdk7+8 - 24mai2011
Terence Barr - jdk7+8 - 24mai2011Terence Barr - jdk7+8 - 24mai2011
Terence Barr - jdk7+8 - 24mai2011
 
Execution model and other must-know's
Execution model and other must-know'sExecution model and other must-know's
Execution model and other must-know's
 

Destaque

การสร้าง organization charts
การสร้าง organization chartsการสร้าง organization charts
การสร้าง organization chartsPhanupong Rong-o
 
WRECTACULAR 2011 exhibitor info
WRECTACULAR 2011 exhibitor infoWRECTACULAR 2011 exhibitor info
WRECTACULAR 2011 exhibitor infojmorgan2077
 
Eng2 d tkm_intro
Eng2 d tkm_introEng2 d tkm_intro
Eng2 d tkm_introdcowley
 
僕の脳で何が起こったか
僕の脳で何が起こったか僕の脳で何が起こったか
僕の脳で何が起こったかJunpei Wada
 
DfC_ny 18112010 design for conversion
DfC_ny 18112010 design for conversionDfC_ny 18112010 design for conversion
DfC_ny 18112010 design for conversionzwijn
 
เทคนิคการทำPs
เทคนิคการทำPsเทคนิคการทำPs
เทคนิคการทำPsPhanupong Rong-o
 
Working With Therapeutic Program Parents
Working With Therapeutic Program ParentsWorking With Therapeutic Program Parents
Working With Therapeutic Program Parentsjudgeforteens
 
การสร้างแผนผัง Organization Chat
การสร้างแผนผัง Organization Chatการสร้างแผนผัง Organization Chat
การสร้างแผนผัง Organization ChatPhanupong Rong-o
 
Arc of developer part2
Arc of developer part2Arc of developer part2
Arc of developer part2Junpei Wada
 
Programação para dispositivos móveis com PhoneGap Cordova
Programação para dispositivos móveis com PhoneGap CordovaProgramação para dispositivos móveis com PhoneGap Cordova
Programação para dispositivos móveis com PhoneGap CordovaEvandro Júnior
 
Antimalarial drug efficacy and drug resistance(yemen)
Antimalarial drug efficacy and drug resistance(yemen)Antimalarial drug efficacy and drug resistance(yemen)
Antimalarial drug efficacy and drug resistance(yemen)Ghamdan Al Tahish
 
Logica de programação / Algoritmos em Portugol
Logica de programação / Algoritmos em PortugolLogica de programação / Algoritmos em Portugol
Logica de programação / Algoritmos em PortugolEvandro Júnior
 

Destaque (18)

การสร้าง organization charts
การสร้าง organization chartsการสร้าง organization charts
การสร้าง organization charts
 
WRECTACULAR 2011 exhibitor info
WRECTACULAR 2011 exhibitor infoWRECTACULAR 2011 exhibitor info
WRECTACULAR 2011 exhibitor info
 
Tuesday
TuesdayTuesday
Tuesday
 
Eng2 d tkm_intro
Eng2 d tkm_introEng2 d tkm_intro
Eng2 d tkm_intro
 
Sample Selection of Styles
Sample Selection of StylesSample Selection of Styles
Sample Selection of Styles
 
僕の脳で何が起こったか
僕の脳で何が起こったか僕の脳で何が起こったか
僕の脳で何が起こったか
 
DfC_ny 18112010 design for conversion
DfC_ny 18112010 design for conversionDfC_ny 18112010 design for conversion
DfC_ny 18112010 design for conversion
 
Comic life
Comic lifeComic life
Comic life
 
เทคนิคการทำPs
เทคนิคการทำPsเทคนิคการทำPs
เทคนิคการทำPs
 
Working With Therapeutic Program Parents
Working With Therapeutic Program ParentsWorking With Therapeutic Program Parents
Working With Therapeutic Program Parents
 
การสร้างแผนผัง Organization Chat
การสร้างแผนผัง Organization Chatการสร้างแผนผัง Organization Chat
การสร้างแผนผัง Organization Chat
 
Arc of developer part2
Arc of developer part2Arc of developer part2
Arc of developer part2
 
Apple Inc
Apple IncApple Inc
Apple Inc
 
Programação para dispositivos móveis com PhoneGap Cordova
Programação para dispositivos móveis com PhoneGap CordovaProgramação para dispositivos móveis com PhoneGap Cordova
Programação para dispositivos móveis com PhoneGap Cordova
 
Antimalarial drug efficacy and drug resistance(yemen)
Antimalarial drug efficacy and drug resistance(yemen)Antimalarial drug efficacy and drug resistance(yemen)
Antimalarial drug efficacy and drug resistance(yemen)
 
Logica de programação / Algoritmos em Portugol
Logica de programação / Algoritmos em PortugolLogica de programação / Algoritmos em Portugol
Logica de programação / Algoritmos em Portugol
 
Burkholderia spp.
Burkholderia spp.Burkholderia spp.
Burkholderia spp.
 
Styles
StylesStyles
Styles
 

Semelhante a Arc of developer part1

Objective-C Survives
Objective-C SurvivesObjective-C Survives
Objective-C SurvivesS Akai
 
ARCでめちゃモテiOSプログラマー
ARCでめちゃモテiOSプログラマーARCでめちゃモテiOSプログラマー
ARCでめちゃモテiOSプログラマーSatoshi Asano
 
iPhone dev intro
iPhone dev introiPhone dev intro
iPhone dev introVonbo
 
Beginning to iPhone development
Beginning to iPhone developmentBeginning to iPhone development
Beginning to iPhone developmentVonbo
 
iOS Memory Management Basics
iOS Memory Management BasicsiOS Memory Management Basics
iOS Memory Management BasicsBilue
 
Automatic Reference Counting
Automatic Reference CountingAutomatic Reference Counting
Automatic Reference Countingpragmamark
 
Writing native bindings to node.js in C++
Writing native bindings to node.js in C++Writing native bindings to node.js in C++
Writing native bindings to node.js in C++nsm.nikhil
 
Agile Iphone Development
Agile Iphone DevelopmentAgile Iphone Development
Agile Iphone DevelopmentGiordano Scalzo
 
Automatic Reference Counting
Automatic Reference CountingAutomatic Reference Counting
Automatic Reference CountingGiuseppe Arici
 
Automatic Reference Counting
Automatic Reference Counting Automatic Reference Counting
Automatic Reference Counting pragmamark
 
Easy undo.key
Easy undo.keyEasy undo.key
Easy undo.keyzachwaugh
 

Semelhante a Arc of developer part1 (11)

Objective-C Survives
Objective-C SurvivesObjective-C Survives
Objective-C Survives
 
ARCでめちゃモテiOSプログラマー
ARCでめちゃモテiOSプログラマーARCでめちゃモテiOSプログラマー
ARCでめちゃモテiOSプログラマー
 
iPhone dev intro
iPhone dev introiPhone dev intro
iPhone dev intro
 
Beginning to iPhone development
Beginning to iPhone developmentBeginning to iPhone development
Beginning to iPhone development
 
iOS Memory Management Basics
iOS Memory Management BasicsiOS Memory Management Basics
iOS Memory Management Basics
 
Automatic Reference Counting
Automatic Reference CountingAutomatic Reference Counting
Automatic Reference Counting
 
Writing native bindings to node.js in C++
Writing native bindings to node.js in C++Writing native bindings to node.js in C++
Writing native bindings to node.js in C++
 
Agile Iphone Development
Agile Iphone DevelopmentAgile Iphone Development
Agile Iphone Development
 
Automatic Reference Counting
Automatic Reference CountingAutomatic Reference Counting
Automatic Reference Counting
 
Automatic Reference Counting
Automatic Reference Counting Automatic Reference Counting
Automatic Reference Counting
 
Easy undo.key
Easy undo.keyEasy undo.key
Easy undo.key
 

Último

Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 

Último (20)

Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 

Arc of developer part1

  • 1. ARC of a Developer Part.1 11 11 22
  • 2. Automatic Referrence Counting • Objective-C • - • - retain release • - weak weak referrence 11 11 22
  • 3. • • EXC_BAD_ACCESS •2 release • NSZombie • • 11 11 22
  • 4. ARC • GC • • retain/release 2.5 • autoreleasepool 6 • objc_msgSend 33% 11 11 22
  • 5. ARC • 11 11 22
  • 6. ARC • ARC • LLVM3.0 • -fobjc-arc 11 11 22
  • 7. -fno-objc-arc 11 11 22
  • 8. • iOS4 weak reference • __unsafe_unretained • weak reference 11 11 22
  • 9. • __strong • __weak • __unsafe_unretained • __autoreleasing • 11 11 22
  • 10. Before ARC • • autorelease • 11 11 22
  • 11. • VB6 • COM • Objective-C • • JAVA .NET Obj-C GC 11 11 22
  • 12. • NSObject *obj = [[NSObject alloc]init]; * obj NSObject 1 11 11 22
  • 13. • NSObject *obj = [[NSObject alloc]init]; • NSObject *obj2 = [obj retain]; * obj NSObject 2 * obj2 11 11 22
  • 14. • NSObject *obj = [[NSObject alloc]init]; • NSObject *obj2 = [obj retain]; • [obj release]; NSObject 1 * obj2 11 11 22
  • 15. • NSObject *obj = [[NSObject alloc]init]; • NSObject *obj2 = [obj retain]; • [obj release]; • [obj2 release]; NSObject 0 11 11 22
  • 16. Autorelease • +(id)array{ NSMutableArray *array = [[[NSMutableArray alloc]init]autorelease]; return array; } * array NSArray 1 11 11 22
  • 17. Autorelease • +(id)array{ NSMutableArray *array = [[[NSMutableArray alloc]init]autorelease]; return array; } * array NSArray release 1 autorelease pool 11 11 22
  • 18. Autorelease • +(id)array{ NSMutableArray *array = [[[NSMutableArray alloc]init]autorelease]; return array; } NSArray release 1 autorelease pool 11 11 22
  • 19. Autorelease • +(id)array{ NSMutableArray *array = [[[NSMutableArray alloc]init]autorelease]; return array; } NSArray 0 11 11 22
  • 20. Retain Release Autorerelease • • 11 11 22
  • 21. 11 11 22
  • 22. • 11 11 22
  • 23. Xcode Static Analyzer • Xcode Analyze • 11 11 22
  • 24. ARC • • Retain Release 11 11 22
  • 25. • __strong • __weak • __unsafe_unretained • __autoreleasing 11 11 22
  • 26. nil • nil • id __strong obj1; • id __strong obj1 = nil; 11 11 22
  • 27. __strong • • id • id test = [[NSObject alloc]init]; • id __strong test = [[NSObject alloc]init]; • retain release • strong 11 11 22
  • 28. __strong • dealloc release • release • Retain • Release 11 11 22
  • 29. __strong +1 +1 { NSMutableArray *array = [[NSMutableArray alloc]init]; [array addObject:[[NSObject alloc]init]]; [array addObject:[[NSObject alloc]init]]; [array addObject:[[NSObject alloc]init]]; [array addObject:[[NSObject alloc]init]]; } • array +1 • array -1 11 11 22
  • 30. Retain { NSMutableArray *array = [[NSMutableArray alloc]init]; [array addObject:[[NSObject alloc]init]]; [array addObject:[[NSObject alloc]init]]; [array addObject:[[NSObject alloc]init]]; [array addObject:[[NSObject alloc]init]]; } @property (nonatomic,retain) NSMutableArray *array; { self.array = [[[NSMutableArray alloc]init]autorelease]; [array addObject:[[[NSObject alloc]init]autorelease]]; [array addObject:[[[NSObject alloc]init]autorelease]]; [array addObject:[[[NSObject alloc]init]autorelease]]; [array addObject:[[[NSObject alloc]init]autorelease]]; } 11 11 22
  • 31. Autorelease • Relase +1 +1 { NSMutableArray *array = [[NSMutableArray alloc]init]; [array addObject:[[NSObject alloc]init]]; [array addObject:[[NSObject alloc]init]]; [array addObject:[[NSObject alloc]init]]; [array addObject:[[NSObject alloc]init]]; } 11 11 22
  • 32. autorelease • autorelease pool +(id)array{ id obj = [[NSMutableArray alloc]init]; return obj; } 11 11 22
  • 33. assign __unsafe_unretained copy __strong retain __strong strong __strong unsafe_unretained __unsafe_unretained weak __weak 11 11 22
  • 34. strong • release retain • 11 11 22
  • 35. 11 11 22
  • 36. A B C E D 11 11 22
  • 37. A B C E D 11 11 22
  • 38. A B C assign E D 11 11 22
  • 39. @interface Test : NSObject{ id childObject; } -(void)setObject:(id)child; @end { id test1 = [[Test alloc]init]; id test2 = [[Test alloc]init]; [test1 setObject:test2]; [test2 setObject:test1]; } 11 11 22
  • 40. { id test1 = [[Test alloc]init]; id test2 = [[Test alloc]init]; [test1 setObject:test2]; [test2 setObject:test1]; } test1 test2 test1 test2 11 11 22
  • 41. __weak • Retain @interface Test : NSObject{ id __weak childObject; } -(void)setObject:(id)child; @end test1 test2 11 11 22
  • 42. __weak • nil • test1 test2 11 11 22
  • 43. __weak +1 id __weak obj = [[NSObject alloc]init]; • delegate 11 11 22
  • 44. autorelease pool • • Thread NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init]; // [pool drain]; @autoreleasepool { // } • LLVM3.0 ARC 11 11 22
  • 45. • 11 11 22
  • 46. 11 11 22