<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Image memory</title>
	<atom:link href="http://www.alexcurylo.com/blog/2009/01/02/image-memory/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.alexcurylo.com/blog/2009/01/02/image-memory/</link>
	<description>Alex Curylo, iPhone Programmer</description>
	<lastBuildDate>Tue, 07 Feb 2012 06:22:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Alex</title>
		<link>http://www.alexcurylo.com/blog/2009/01/02/image-memory/comment-page-1/#comment-3306</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Fri, 11 Jun 2010 06:43:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.alexcurylo.com/blog/?p=367#comment-3306</guid>
		<description>&quot;Am i using the right way to implement imageWithContentsOfFile&quot;

No. Here&#039;s a function demonstrating how to use it.

- (UIImage *)poseImage:(NSString*)fileName
{
   NSString *pictureFile = [NSString stringWithFormat:@&quot;%@/pictures/%@.jpg&quot;, [[NSBundle mainBundle] resourcePath], fileName];
   UIImage *picture = [UIImage imageWithContentsOfFile:pictureFile];
   return picture;
}

Your picture files will probably be directly in your resource path, not in /pictures/ as in the above sample.</description>
		<content:encoded><![CDATA[<p>&#8220;Am i using the right way to implement imageWithContentsOfFile&#8221;</p>
<p>No. Here&#8217;s a function demonstrating how to use it.</p>
<p>- (UIImage *)poseImage:(NSString*)fileName<br />
{<br />
   NSString *pictureFile = [NSString stringWithFormat:@"%@/pictures/%@.jpg", [[NSBundle mainBundle] resourcePath], fileName];<br />
   UIImage *picture = [UIImage imageWithContentsOfFile:pictureFile];<br />
   return picture;<br />
}</p>
<p>Your picture files will probably be directly in your resource path, not in /pictures/ as in the above sample.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Abhishek</title>
		<link>http://www.alexcurylo.com/blog/2009/01/02/image-memory/comment-page-1/#comment-3305</link>
		<dc:creator>Abhishek</dc:creator>
		<pubDate>Fri, 11 Jun 2010 05:51:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.alexcurylo.com/blog/?p=367#comment-3305</guid>
		<description>And when i store the images with the following code:

        alphabet_Array = [[NSMutableArray alloc] initWithCapacity:26];
	for (i = 1; i &lt;= 26; i  )
	{	
		picName = [NSString stringWithFormat:@&quot;Alphabet_%d.png&quot;,i];
		[alphabet_Array addObject: [UIImage imageWithContentsOfFile:picName]];
	}
..
..

instead of:

        alphabet_Array = [[NSMutableArray alloc] initWithCapacity:26];
	for (i = 1; i &lt;= 26; i  )
	{	
		picName = [NSString stringWithFormat:@&quot;Alphabet_%d.png&quot;,i];
		[alphabet_Array addObject: [UIImage imageNamed:picName]];
	}


then i get the following messages:

2010-06-11 11:18:27.826 KeyBreaker[810:207] *** Terminating app due to uncaught exception &#039;NSInvalidArgumentException&#039;, reason: &#039;*** -[NSCFArray insertObject:atIndex:]: attempt to insert nil&#039;
2010-06-11 11:18:27.837 KeyBreaker[810:207] Stack: (
    852041337,
    861292157,
    852040821,
    852041023,
    850612251,
    850434453,
    850434289,
    13413,
    828201059,
    828199873,
    827153745,
    827153023,
    827464035,
    827462369,
    827460907,
    819342131,
    851590557,
    851588321,
    827151529,
    827144691,
    12195,
    12120
)
terminate called after throwing an instance of &#039;NSException&#039;
Program received signal:  “SIGABRT”.
(gdb) 

..
..
but i think this is my mistake...
Am i using the right way to implement imageWithContentsOfFile</description>
		<content:encoded><![CDATA[<p>And when i store the images with the following code:</p>
<p>        alphabet_Array = [[NSMutableArray alloc] initWithCapacity:26];<br />
	for (i = 1; i &lt;= 26; i  )<br />
	{<br />
		picName = [NSString stringWithFormat:@&quot;Alphabet_%d.png&quot;,i];<br />
		[alphabet_Array addObject: [UIImage imageWithContentsOfFile:picName]];<br />
	}<br />
..<br />
..</p>
<p>instead of:</p>
<p>        alphabet_Array = [[NSMutableArray alloc] initWithCapacity:26];<br />
	for (i = 1; i &lt;= 26; i  )<br />
	{<br />
		picName = [NSString stringWithFormat:@&quot;Alphabet_%d.png&quot;,i];<br />
		[alphabet_Array addObject: [UIImage imageNamed:picName]];<br />
	}</p>
<p>then i get the following messages:</p>
<p>2010-06-11 11:18:27.826 KeyBreaker[810:207] *** Terminating app due to uncaught exception &#039;NSInvalidArgumentException&#039;, reason: &#039;*** -[NSCFArray insertObject:atIndex:]: attempt to insert nil&#039;<br />
2010-06-11 11:18:27.837 KeyBreaker[810:207] Stack: (<br />
    852041337,<br />
    861292157,<br />
    852040821,<br />
    852041023,<br />
    850612251,<br />
    850434453,<br />
    850434289,<br />
    13413,<br />
    828201059,<br />
    828199873,<br />
    827153745,<br />
    827153023,<br />
    827464035,<br />
    827462369,<br />
    827460907,<br />
    819342131,<br />
    851590557,<br />
    851588321,<br />
    827151529,<br />
    827144691,<br />
    12195,<br />
    12120<br />
)<br />
terminate called after throwing an instance of &#039;NSException&#039;<br />
Program received signal:  “SIGABRT”.<br />
(gdb) </p>
<p>..<br />
..<br />
but i think this is my mistake&#8230;<br />
Am i using the right way to implement imageWithContentsOfFile</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Abhishek</title>
		<link>http://www.alexcurylo.com/blog/2009/01/02/image-memory/comment-page-1/#comment-3302</link>
		<dc:creator>Abhishek</dc:creator>
		<pubDate>Fri, 11 Jun 2010 05:45:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.alexcurylo.com/blog/?p=367#comment-3302</guid>
		<description>@ Alex

Can u put a sample code as to how to use imageWithContentsOfFile...
This is what i have done:

     alphabet_Array = [[NSMutableArray alloc] initWithCapacity:26];
     for (i = 1; i &lt;= 26; i  )
     {	
	     picName = [NSString stringWithFormat:@&quot;Alphabet_%d.png&quot;,i];
	     [alphabet_Array addObject: [UIImage imageNamed:picName]];
     }

..
..
Now what happens is the total size of all my images is around 4 MB and i am storing all of them in arrays using the above method
so when i launch the game in iPad (Yes Sir &quot;iPad&quot; not iPod), it crashes immediately and gives the following error messages:


warning: Unable to read symbols for &quot;/Developer/Platforms/iPhoneOS.platform/DeviceSupport/3.2 (7B367)/Symbols/System/Library/AccessibilityBundles/AccessibilitySettingsLoader.bundle/AccessibilitySettingsLoader&quot; (file not found).
Program received signal:  “0”.

The Debugger has exited due to signal 10 (SIGBUS).The Debugger has exited due to signal 10 (SIGBUS).
(gdb) 
..
..
..
..
can u help with me with anything u can
i need to store all the images as i m making a game and will be needing those images very often</description>
		<content:encoded><![CDATA[<p>@ Alex</p>
<p>Can u put a sample code as to how to use imageWithContentsOfFile&#8230;<br />
This is what i have done:</p>
<p>     alphabet_Array = [[NSMutableArray alloc] initWithCapacity:26];<br />
     for (i = 1; i &lt;= 26; i  )<br />
     {<br />
	     picName = [NSString stringWithFormat:@&quot;Alphabet_%d.png&quot;,i];<br />
	     [alphabet_Array addObject: [UIImage imageNamed:picName]];<br />
     }</p>
<p>..<br />
..<br />
Now what happens is the total size of all my images is around 4 MB and i am storing all of them in arrays using the above method<br />
so when i launch the game in iPad (Yes Sir &quot;iPad&quot; not iPod), it crashes immediately and gives the following error messages:</p>
<p>warning: Unable to read symbols for &quot;/Developer/Platforms/iPhoneOS.platform/DeviceSupport/3.2 (7B367)/Symbols/System/Library/AccessibilityBundles/AccessibilitySettingsLoader.bundle/AccessibilitySettingsLoader&quot; (file not found).<br />
Program received signal:  “0”.</p>
<p>The Debugger has exited due to signal 10 (SIGBUS).The Debugger has exited due to signal 10 (SIGBUS).<br />
(gdb)<br />
..<br />
..<br />
..<br />
..<br />
can u help with me with anything u can<br />
i need to store all the images as i m making a game and will be needing those images very often</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tools: Clang at Under The Bridge</title>
		<link>http://www.alexcurylo.com/blog/2009/01/02/image-memory/comment-page-1/#comment-1350</link>
		<dc:creator>Tools: Clang at Under The Bridge</dc:creator>
		<pubDate>Sat, 16 May 2009 03:11:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.alexcurylo.com/blog/?p=367#comment-1350</guid>
		<description>[...] we&#8217;ve mentioned the LLVM/Clang Static Analyzer already in passing, but there&#8217;s enough resources springing up all over to merit some more [...]</description>
		<content:encoded><![CDATA[<p>[...] we&#8217;ve mentioned the LLVM/Clang Static Analyzer already in passing, but there&#8217;s enough resources springing up all over to merit some more [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: iPhone Developer resources &#124; MikkoLehtinen.com</title>
		<link>http://www.alexcurylo.com/blog/2009/01/02/image-memory/comment-page-1/#comment-726</link>
		<dc:creator>iPhone Developer resources &#124; MikkoLehtinen.com</dc:creator>
		<pubDate>Tue, 27 Jan 2009 15:17:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.alexcurylo.com/blog/?p=367#comment-726</guid>
		<description>[...] Using CLANG static analyzer with an iPhone project [...]</description>
		<content:encoded><![CDATA[<p>[...] Using CLANG static analyzer with an iPhone project [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://www.alexcurylo.com/blog/2009/01/02/image-memory/comment-page-1/#comment-712</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Sat, 17 Jan 2009 15:59:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.alexcurylo.com/blog/?p=367#comment-712</guid>
		<description>Well, if you&#039;ve actually got more images than memory, you will have to release them yourself eventually.

What using imageWithContentsOfFile: does for you is that you actually have the opportunity to see the allocations and manage them yourself rather than having the System go down behind your back like imageNamed: will do on you.</description>
		<content:encoded><![CDATA[<p>Well, if you&#8217;ve actually got more images than memory, you will have to release them yourself eventually.</p>
<p>What using imageWithContentsOfFile: does for you is that you actually have the opportunity to see the allocations and manage them yourself rather than having the System go down behind your back like imageNamed: will do on you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rich</title>
		<link>http://www.alexcurylo.com/blog/2009/01/02/image-memory/comment-page-1/#comment-711</link>
		<dc:creator>Rich</dc:creator>
		<pubDate>Sat, 17 Jan 2009 08:17:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.alexcurylo.com/blog/?p=367#comment-711</guid>
		<description>Hey Guys,
I had exactly the same issue - Many images to display in various views was causing memory warnings after a while for no apparent reason (App usage was about 1M). I changed all my [UIimage imageNamed:] references to [UIImage imageWithContentsOfFile:] and things are defiantly better.

However, although I can view many more images than previous, I&#039;m still get a memory warning after a while and a bit later my application terminates. Do you know of any problem that imageWithContentsOfFile: may be causing ?</description>
		<content:encoded><![CDATA[<p>Hey Guys,<br />
I had exactly the same issue &#8211; Many images to display in various views was causing memory warnings after a while for no apparent reason (App usage was about 1M). I changed all my [UIimage imageNamed:] references to [UIImage imageWithContentsOfFile:] and things are defiantly better.</p>
<p>However, although I can view many more images than previous, I&#8217;m still get a memory warning after a while and a bit later my application terminates. Do you know of any problem that imageWithContentsOfFile: may be causing ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: imageNamed is evil at Under The Bridge</title>
		<link>http://www.alexcurylo.com/blog/2009/01/02/image-memory/comment-page-1/#comment-709</link>
		<dc:creator>imageNamed is evil at Under The Bridge</dc:creator>
		<pubDate>Wed, 14 Jan 2009 05:06:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.alexcurylo.com/blog/?p=367#comment-709</guid>
		<description>[...] a little while back we wrote about the confusing crashes on the device that we eventually figured out were caused by [...]</description>
		<content:encoded><![CDATA[<p>[...] a little while back we wrote about the confusing crashes on the device that we eventually figured out were caused by [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>

