<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ARC &#8211; Xojo Programming Blog</title>
	<atom:link href="https://blog.xojo.com/tag/arc/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.xojo.com</link>
	<description>Blog about the Xojo programming language and IDE</description>
	<lastBuildDate>Wed, 21 Sep 2016 18:17:37 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>Tip: Automatic Reference Counting</title>
		<link>https://blog.xojo.com/2016/01/18/tip-automatic-reference-counting/</link>
		
		<dc:creator><![CDATA[Paul Lefebvre]]></dc:creator>
		<pubDate>Mon, 18 Jan 2016 00:00:00 +0000</pubDate>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[ARC]]></category>
		<guid isPermaLink="false">http://blogtemp.xojo.com/2016/01/18/tip-automatic-reference-counting/</guid>

					<description><![CDATA[Learn about automatic reference counting (ARC) for object-oriented programming code memory management.]]></description>
										<content:encoded><![CDATA[<p>As defined on <a href="https://en.wikipedia.org/wiki/Automatic_Reference_Counting">Wikipedia</a>, Automatic Reference Counting (or ARC) is a &#8220;memory management enhancement where the burden of keeping track of an object&#8217;s reference count is lifted from the programmer to the compiler.&#8221;</p>
<p>With object-oriented programming, each new object you create takes up space in memory. This memory needs to be managed somehow. In the beginning, this management of memory was left entirely to the programmer, such as with C++ or originally with Objective-C.</p>
<p><span id="more-235"></span>Starting with Java, the concept of <a href="https://en.wikipedia.org/wiki/Garbage_collection_(computer_science)">garbage collection</a> became more popular. With garbage collection, the language run-time periodically purges objects from memory when they are no longer referenced. This is pretty easy on the programmer since they don&#8217;t have to worry about anything, but it can cause some <a href="http://www.dynatrace.com/en/javabook/impact-of-garbage-collection-on-performance.html">significant performance problems</a> for your app when the garbage collector is running.</p>
<p>An alternative that has became more popular in recent years is Automatic Reference Counting. You can think of ARC as the &#8220;<a href="https://en.wikipedia.org/wiki/Goldilocks_principle">just right</a>&#8221; memory management strategy. With this technique, the language tracks references to objects and when an object&#8217;s reference count reaches 0, it is automatically and immediately removed from memory. This feature most recently generated a lot of interest when Objective-C added it a few years ago. You&#8217;re hearing more about it again as Swift also makes use of this memory management technique.</p>
<p>But ARC is old news for Xojo developers. Xojo has been using ARC since 1998 (v1.0)!</p>
<p>ARC really is a great way to handle object memory management. With ARC you generally don&#8217;t have to worry about memory management except for the special case of circular references. In those cases, you&#8217;ll need to manually release an object (set it to Nil) so that its reference count decreases to allow it to eventually reach 0, thus allowing it to get removed from memory. This special case does not occur often, but when it does you can make use of <a href="http://developer.xojo.com/xojo-core-weakref">Weak References</a> to help mitigate it.</p>
<p><!--HubSpot Call-to-Action Code --> <span id="hs-cta-wrapper-de1ba131-3831-49df-90a1-b9efde8e17d2" class="hs-cta-wrapper"> <span id="hs-cta-de1ba131-3831-49df-90a1-b9efde8e17d2" class="hs-cta-node hs-cta-de1ba131-3831-49df-90a1-b9efde8e17d2"><br />
<!-- [if lte IE 8]>


<div id="hs-cta-ie-element"></div>


<![endif]--> <a href="http://blog.xojo.com/2015/12/21/speed-up-sqlite-with-write-ahead-logging/" target="_blank"><img decoding="async" id="hs-cta-img-de1ba131-3831-49df-90a1-b9efde8e17d2" class="hs-cta-img aligncenter" style="border-width: 0px; margin: 0 auto; display: block; margin-top: 20px; margin-bottom: 20px;" src="https://blog.xojo.com/wp-content/uploads/2016/01/de1ba131-3831-49df-90a1-b9efde8e17d2.png" alt="Code Tip: Speed up SQLite with Write-Ahead Logging" width="393" height="72" align="middle" /></a></span></span> <!-- end HubSpot Call-to-Action Code --></p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
