Utente:Filnik/sandbox: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
decat
temp save
Riga 1:
Nella programmazione [[Objective-C]], '''Automatic Reference Counting''' (ARC) è un miglioramento del sistema di gestione della memoria, dove il problema di tenere traccia del [[Reference counting|reference count]] di un [[Oggetto (informatica)|oggetto]]
[[:Immagine:Test botolo!.jpg]]
 
!Immagine:Test botolo!.jpg
is a memory management enhancement where the burden of keeping track of an [[Object (computer science)|object's]] [[Reference counting|reference count]] is lifted from the programmer to the compiler.<ref name=Ars>{{cite web|last=Siracusa|first=John|title=Automatic Reference Counting|url=http://arstechnica.com/apple/2011/07/mac-os-x-10-7/10/#arc|work=Mac OS X 10.7 Lion: the Ars Technica review|publisher=http://arstechnica.com|accessdate=15 August 2012}}</ref> In traditional Objective-C, the programmer would send <code>retain</code> and <code>release</code> messages to objects in order to mark objects for deallocation or to prevent deallocation.<ref name=Cruz>{{cite web|last=Cruz|first=José R.C.|title=Automatic Reference Counting on iOS|url=http://www.drdobbs.com/mobile/automatic-reference-counting-on-ios/240000820|publisher=Dr.Dobb's|accessdate=21 August 2012}}</ref> Under ARC, the compiler does this automatically by examining the source code and then add the <code>retain</code> and <code>release</code> messages in the compiled code.<ref name=Kochan>{{cite book|last=Kochan|first=Stephen G.|title=Programming in Objective-C|year=1912|publisher=Addison-Wesley|location=Boston, Mass.|isbn=978-0321811905|pages=408|edition=4th}}</ref>
vediamo se funziona
 
ARC is not the same thing as [[Garbage collection (computer science)|garbage collection]], as there are no background process doing the deallocation of objects.<ref name=Hoffman>{{cite book|last=Hoffman|first=Kevin|title=Sams teach yourself Mac OS X Lion app development in 24 hours|year=2012|publisher=Sams|location=Indianapolis, Ind.|isbn=9780672335815|pages=73}}</ref> Unlike garbage collection, ARC does not handle [[Reference counting#reference cycle| reference cycles]] automatically; It is up to the programmer to break cycles using [[weak reference|weak references]].<ref name=clang>{{cite web|title=General|url=http://clang.llvm.org/docs/AutomaticReferenceCounting.html#general|work=Automatic Reference Counting|publisher=http://clang.llvm.org|accessdate=15 August 2012}}</ref>
 
ARC was introduced by [[Apple Inc.]] in 2011 for application development on its [[Mac OS X Lion]] and [[iOS 5]] [[operating systems]].<ref name=Sakamato>{{cite book|last=Sakamoto|first=Kazuki|title=Pro Multithreading and Memory Management for Ios and OS X With Arc, Grand Central Dispatch and Blocks.|year=2012|publisher=Apress|isbn=978-1430241164|pages=xii}}</ref>
 
David Chisnall at informIT views ARC as the "first significant improvement to Objective-C since the 1980s".<ref name=Chisnall>{{cite web|last=Chisnall|first=David|title=Automatic Reference Counting in Objective-C, Part 2: The Details|url=http://www.informit.com/articles/article.aspx?p=1745876&seqNum=3|publisher=informIT|accessdate=18 August 2012}}</ref>
 
ARC is supported in [[Xcode]] 4.2 or later, [[Mac OS X 10.6]] "Snow Leopard" or later, and [[iOS]] 4.0 or later, although at least [[Mac OS X 10.7]] "Lion" or [[iOS 5]] is recommended to use all the features, including weak reference support.