<?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>Gorges Blog &#187; Android DDMT</title>
	<atom:link href="http://blog.GORGES.us/tag/android-ddmt/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.GORGES.us</link>
	<description>Web Sites that Grow Your Business - our blog</description>
	<lastBuildDate>Mon, 06 Feb 2012 14:23:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Developing Apps within Android&#8217;s 16MB Memory Limit</title>
		<link>http://blog.GORGES.us/2010/07/developing-apps-within-androids-16mb-memory-limit/</link>
		<comments>http://blog.GORGES.us/2010/07/developing-apps-within-androids-16mb-memory-limit/#comments</comments>
		<pubDate>Fri, 16 Jul 2010 13:49:19 +0000</pubDate>
		<dc:creator>Matt Clark</dc:creator>
				<category><![CDATA[Mobile Development]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Android DDMT]]></category>
		<category><![CDATA[device apps]]></category>
		<category><![CDATA[device programming]]></category>
		<category><![CDATA[Eclipse MAT]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[mobile apps]]></category>

		<guid isPermaLink="false">http://blog.GORGES.us/?p=269</guid>
		<description><![CDATA[One challenge to developing for the Android platform is how to squeeze everything into 16 megabytes of heap space.  This blog post lists several solutions for memory-limited Android apps.]]></description>
			<content:encoded><![CDATA[<p>One challenge to developing for the Android platform is how to  squeeze everything into 16 megabytes of heap space.  App-phones with  16GB and 32GB are common, but that is solid state storage and not RAM.   For Android applications, the limit for each application is 16MB (24MB  on newer Droid and Nexus One phones).</p>
<p>Images, audio, and video are  memory-intensive items, and many apps have these features. There are  tools to help monitor memory use (e.g. Eclipse MAT, Android DDMS), and  these tools are good for diagnosing problems, but you still need to  understand enough to be able to fix memory leaks.</p>
<p>Here are  some ideas for reducing the memory footprint of your application:</p>
<p><strong>Reduce  image sizes</strong>:  Lower the width, height, pixel bit-depth, and  compress your images as much as you can.  Of course when an image is  uncompressed and loaded into a Bitmap object then it takes up more  memory, but you can reduce the memory footprint by lowering the image  quality (for example see: View.setDrawingCacheQuality and  View.DRAWING_CACHE_QUALITY_LOW) or even disabling the cache on views containing images.</p>
<p><strong>Lower  audio and video bitrates:</strong> I don&#8217;t know this for a fact, but I  would guess that a lower-bitrate audio stream may have a smaller memory  requirement during playback.  For example a mono-48 kbit/second audio  file would require decoded fewer samples per second than a stereo-192  kbit/second file. (Please comment to this post if you test this theory  or know the answer.)</p>
<p><strong>Destroy or reuse objects:</strong> When  you can, re-use objects and make sure that old objects are  fully-destroyed. when they are no used anymore.  Even better, never  create objects in the first place if possible.  This is especially true  for bitmap objects &#8211; be sure to call the Bitmap.recycle() method.  Remember to clear callback methods of objects before destroying them,  because otherwise an object may not be properly returned to the memory  heap during a java garbage collection operation.</p>
<p><strong>Use final  and static</strong>:  Virtual methods take up more space, and are slower,  than static methods.  Final variables and arrays are stored in code  space and not the memory heap.  Granted the difference is very small  compared with 16MB of space, but every little bit counts!</p>
<p><strong>Separate  applications for localization</strong>:  If you are developing apps for  multiple languages, consider creating separate applications instead of  including all the language-specific strings, images, audio files, and  videos in a single application.</p>
<p><strong>Rely on external storage</strong>:   If you know that there is smart-card memory available, use that to store  data instead of in memory.</p>
<p><strong>Revert to an earlier Android SDK:</strong> When we reverted our most-memory-challenged Android application from  Android 2.2 to Android 1.5, we gained two important things: first, we  are now compatible with almost all existing Android phones; and second  we reduced our memory footprint by almost a megabyte.  This latter  statement is extremely interesting, since it indicates that the Android  framework is getting bloated by all the new features added between  versions 1.5 and 2.2.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.GORGES.us/2010/07/developing-apps-within-androids-16mb-memory-limit/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

