<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.1" -->
<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">
	<channel>
		<title>cocos2d for iPhone &#187; Tag: memory - Recent Topics</title>
		<link>http://www.cocos2d-iphone.org/forum/tags/memory</link>
		<description>A fast, easy to use, free, and community supported 2D game engine</description>
		<language>en-US</language>
		<pubDate>Fri, 10 Feb 2012 04:05:17 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.1</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://www.cocos2d-iphone.org/forum/search.php</link>
		</textInput>
		<atom:link href="http://www.cocos2d-iphone.org/forum/rss/tags/memory/topics" rel="self" type="application/rss+xml" />

		<item>
			<title>neigaard on "Is it possible to mix RGBA8888 and RGBA4444 in the same scene/layer?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/29122#post-143489</link>
			<pubDate>Thu, 09 Feb 2012 19:28:56 +0000</pubDate>
			<dc:creator>neigaard</dc:creator>
			<guid isPermaLink="false">143489@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi</p>
<p>I would like to use RGBA4444 in some of my PVR textures and RGBA8888 in others of my PVR textures. No as I understand it the PVR includes information about wether it is RGBA8888 or RGBA4444, but will cocos2d work well with this also reducing memory usage on the RGBA4444 textures and still render my RGBA8888 textures in lovely 32 bit?</p>
<p>Thank you<br />
Søren
</p></description>
		</item>
		<item>
			<title>callispo on "Cut the Rope style intro video"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28851#post-142149</link>
			<pubDate>Wed, 01 Feb 2012 14:55:45 +0000</pubDate>
			<dc:creator>callispo</dc:creator>
			<guid isPermaLink="false">142149@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I was wondering, the intro animation of Cut the Rope, in which theres a knock on the door, and Om Nom appears in a box, etc. How is this made? Is there any way I can embed videos in my game like that, because making a video like that, by using CCSprites and CCAnimation would consume a lot of memory.
</p></description>
		</item>
		<item>
			<title>pfg2009 on "Getting texture pixels without using glReadPixels()"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28677#post-141302</link>
			<pubDate>Thu, 26 Jan 2012 02:11:03 +0000</pubDate>
			<dc:creator>pfg2009</dc:creator>
			<guid isPermaLink="false">141302@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I have CCRenderTexture into which I draw stuff using the following method:</p>
<pre><code>CCRenderTexture* myTexture = ...;
[myTexture begin];
[someSprite visit];
[myTexture end];</code></pre>
<p>Occasionally, I want to peek back into this texture and read a bunch of pixels to do some additional processing with them.  I can accomplish this with glReadPixels() thusly:</p>
<pre><code>GLubyte* pixels = malloc(section_width * section_height * sizeof(GLubyte) * 4);
glBindTexture(GL_TEXTURE_2D, textureName);
glReadPixels(x, y, w, h, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
glBindTexture(GL_TEXTURE_2D, nil);</code></pre>
<p>This works, but it's slow for my needs and the question I have is whether I can accomplish this same task faster, by avoiding glReadPixels somehow.  Any suggestions?</p>
<p>I figured, I could keep a pointer to the raw data representing the texture in way similar to CCMutableTexture2D that has been used by folks on this forum (for example <a href="http://www.cocos2d-iphone.org/forum/topic/11745">here</a>).  In the CCMutableTexture2D, that data is passed to the GPU using glTexImage2D().  Does that method <strong>copy</strong> the data into GPU's memory or does it simply direct GPU to <strong>use</strong> that piece of memory without duplicating it?  If it's the former, I could just look through the raw data as it's updated via the CCRenderTexture begin/end method without having to call glReadPixels().  If it's the latter, I'm out of ideas.</p>
<p>Any help is much appreciated!
</p></description>
		</item>
		<item>
			<title>rgaino on "Removing unused sprite sheet not freeing up memory"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28075#post-138045</link>
			<pubDate>Thu, 05 Jan 2012 00:43:24 +0000</pubDate>
			<dc:creator>rgaino</dc:creator>
			<guid isPermaLink="false">138045@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi all,</p>
<p>I'm trying to free up memory by removing an unused spritesheet but as I observe the memory using Instruments, the memory just keeps increasing.</p>
<p>The class in question is called HumanSprite and it is a subclass of CCSprite. The "human"  can be one of several sprite sheets I have, randomly selected. Every time this class is loaded, I bring a different sprite sheet and unload the previous. There's always only one human loaded, never zero or more than one, hence it's a singleton.</p>
<p>Here's the init method of Human Sprite:</p>
<p><code><br />
+(id) humanSpriteForScene:(CCLayer*) scene<br />
{</p>
<p>    if(humanId != -1)<br />
    {<br />
        NSLog(@"Removing sprite sheet for human number %03d", humanId);<br />
        [[CCSpriteFrameCache sharedSpriteFrameCache] removeSpriteFramesFromFile:[NSString stringWithFormat:@"HumanAnimations_%03d.plist", humanId]];</p>
<p>    }</p>
<p>    HumanSpriteRandomizer *humanSpriteRandomizer = [HumanSpriteRandomizer getInstance];<br />
    humanId = [humanSpriteRandomizer getNextHumanId];</p>
<p>    NSLog(@"Rendering human number %03d", humanId);</p>
<p>    CCSpriteBatchNode *spriteSheet = [CCSpriteBatchNode batchNodeWithFile: [NSString stringWithFormat:@"HumanAnimations_%03d.pvr.ccz", humanId]];<br />
    [scene addChild:spriteSheet z:10];<br />
    [[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:[NSString stringWithFormat:@"HumanAnimations_%03d.plist", humanId]];</p>
<p>    CCSpriteFrame *frame = [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:[NSString stringWithFormat:@"human_%03d_standing.png", humanId]];<br />
    HumanSprite *humanSprite = [self spriteWithSpriteFrame:frame];<br />
    [spriteSheet addChild:humanSprite z:10];</p>
<p>	return humanSprite;<br />
}<br />
</code></p>
<p>On my game, the first time I bring in the human, I use:</p>
<p><code><br />
    humanSprite = [HumanSprite humanSpriteForScene:self];<br />
</code></p>
<p>and all subsequent humans are loaded as:</p>
<p><code><br />
    [self removeChild:humanSprite cleanup:YES];<br />
    humanSprite = [HumanSprite humanSpriteForScene:self];<br />
</code></p>
<p>Does anyone have any idea why the human sprite sheet is not releasing memory? Should I not be using a singleton on this case (so far it's my only hunch)?</p>
<p>Thanks!
</p></description>
		</item>
		<item>
			<title>MasterP on "Invisible sprites and memory"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28648#post-141123</link>
			<pubDate>Wed, 25 Jan 2012 10:11:35 +0000</pubDate>
			<dc:creator>MasterP</dc:creator>
			<guid isPermaLink="false">141123@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I notice that when I load a sprite from a file (the size is 512x512 and is PVRTC), instruments indicates the memory usage has gone up, as it should.  But, if I set the sprite visible property to false right away after loading, the memory usage goes up only slightly.  Of course, when I set the visible property back to true again, the memory usage goes back up where it was before.  Is this memory reading accurate?  If so, does this mean i can load all my images up front and set only those images which are needed right now to visible?<br />
Thanks.
</p></description>
		</item>
		<item>
			<title>Bahamut on "About release and retain..."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28629#post-141029</link>
			<pubDate>Tue, 24 Jan 2012 17:40:55 +0000</pubDate>
			<dc:creator>Bahamut</dc:creator>
			<guid isPermaLink="false">141029@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I think im a bit confused about how it works.<br />
What is a "reference count"? What is release and retain?<br />
Do i have to release the object everytime i "use" it?</p>
<p>Where can i read more about properties? (@property (nonatomic, retain), etc.)
</p></description>
		</item>
		<item>
			<title>rnystrom on "Background music size, what is too large?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28400#post-139801</link>
			<pubDate>Tue, 17 Jan 2012 05:42:50 +0000</pubDate>
			<dc:creator>rnystrom</dc:creator>
			<guid isPermaLink="false">139801@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I have a 9mb mp3 that I have been using as placeholder background music. Lately I've been getting random crashes on my device. I'm removing the music and going to test without it, but it made me think...</p>
<p>What is a good maximum size/filetype for background music?
</p></description>
		</item>
		<item>
			<title>ktowncoder on "Release necessary after removeFromParentAndCleanup:YES?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28404#post-139812</link>
			<pubDate>Tue, 17 Jan 2012 07:56:05 +0000</pubDate>
			<dc:creator>ktowncoder</dc:creator>
			<guid isPermaLink="false">139812@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Does removeFromParentAndCleanup imply that the object is released? Thanks!
</p></description>
		</item>
		<item>
			<title>Duckwit on "[?]Advice on creating/using a &#039;super-format&#039;"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28308#post-139283</link>
			<pubDate>Thu, 12 Jan 2012 20:45:06 +0000</pubDate>
			<dc:creator>Duckwit</dc:creator>
			<guid isPermaLink="false">139283@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Heh, I'm still young and I still have time to make choices like these -&#62; I've been 'developing a game' of sorts for a few months now (including learning C and Obj-C then that makes it over a year) but after really taking into the account the situation and where I was headed with the project I came to the conclusion that it was far to ambitious.<br />
I have the skill to do all the art, animation, and programming (A lot of experience with Adobe Flash CS5 and love maths) but there is not enough TIME.  </p>
<p>I also thought my game would not be suitable for the market/mobile technology/touch and accelerometer input/especially for the time it would take to develop. </p>
<p>New plan. :) </p>
<p>This game is on a much smaller scale and overall open to much more optimization to the efficiency of my workflow. </p>
<p>The game is platformer-ish (&#60;- *Insert references to innovative secrets here*) and I want it to be really easy for:<br />
A) Me to create levels (possibly using an external program)<br />
B)The user to create levels ('simple' drag and drop from objects list)<br />
--------------------------------------------------------<br />
TL;DR<br />
--------------------------------------------------------<br />
I want to have a file format that allows me to easily store and transfer/upload/download levels.<br />
I need a very minuscule set of variables because all the logic and such will be determined upon loading the level. </p>
<p>Variables per object:<br />
Object: Type:(integer value corresponding to a collection of objects defined in code that each have individual logic patterns/graphics)<br />
Position.x<br />
Position.y<br />
-(Possibly)Some other attributes</p>
<p>I'd like to be able to save/load this data REALLY fast and be in a very simple format that is easily transportable (e.g. online, through e-mail, social networks etc...)<br />
Some ideas I had in mind were using strings of characters and numbers in a recognizable format like:<br />
f247897 -&#62; f (type of object represented by a letter) 247 (pos.x) 897 (pos.y)<br />
Or even to allow for simple digit value changing: </p>
<p>f1036z12000 -&#62; Where z is recognized as the divide between the two positions </p>
<p>This seams like a very compact way of storing data in just a simple NSString (Not sure how to actually save an NString other than overkilling with a .plist :P)<br />
Perhaps there is a way to split a string into characters and store them individually in an array of sorts? Of course to compare the characters and load data corresponding to their significance/value. </p>
<p>I'm very open and looking forward to ideas/discussion about this topic - I don't see it/haven't seen it around very much. :)
</p></description>
		</item>
		<item>
			<title>MartineC on "Frame not found? Console isn&#039;t updating?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28172#post-138582</link>
			<pubDate>Sun, 08 Jan 2012 00:44:01 +0000</pubDate>
			<dc:creator>MartineC</dc:creator>
			<guid isPermaLink="false">138582@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I'm following a great tutorial by Todd Perkins. </p>
<p>The build succeeded, but the simulator doesn't show everything. The buttons for the menu doesn't show up.</p>
<p> I looked in the console and this is the error:</p>
<p>1-2012-01-07 18:26:57.507 GameTest[2043:207] cocos2d: CCSpriteFrameCache: Frame 'button_b.png' not found<br />
2-2012-01-07 18:26:57.509 GameTest[2043:207] I'm in the super initwithtext method<br />
3-2012-01-07 18:26:57.510 GameTest[2043:207] cocos2d: CCSpriteFrameCache: Frame 'button_b.png' not found<br />
4-2012-01-07 18:26:57.513 GameTest[2043:207] I'm in the super initwithtext method<br />
5-2012-01-07 18:26:57.516 GameTest[2043:207] cocos2d: CCSpriteFrameCache: Frame 'button_b.png' not found<br />
6-2012-01-07 18:26:57.517 GameTest[2043:207] I'm in the super initwithtext method<br />
7-2012-01-07 18:26:57.518 GameTest[2043:207] cocos2d: CCSpriteFrameCache: Frame 'button_b.png' not found<br />
8-2012-01-07 18:26:57.519 GameTest[2043:207] I'm in the super initwithtext method<br />
9-2012-01-07 18:26:57.536 GameTest[2043:207] cocos2d: Frame interval: 1<br />
Terminating in response to SpringBoard's termination.</p>
<p>I tried to change the NSLog for "I'm in", I added a button called "button_s.png" but it's not<br />
updating anything. I tried to close and reopen my project but the same error is showing up.</p>
<p>In GameButton.h, it's this:</p>
<pre><code>#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#34;cocos2d.h&#34;

@interface GameButton : CCSprite{

}

+(id)buttonWithText: (NSString *)buttonText isBig:(BOOL)big;
+(id)buttonWithText: (NSString *)buttonText;

-(id)initWithText:(NSString*) buttonText isBig:(BOOL)big;

@end</code></pre>
<p>The code in GameButton.m</p>
<pre><code>#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#34;GameButton.h&#34;

@implementation GameButton

+(id)buttonWithText:(NSString *)buttonText isBig:(BOOL)big
{
	return[[[GameButton alloc]initWithText:buttonText isBig:big] autorelease];
}

+(id)buttonWithText:(NSString *)buttonText
{
	return [[[GameButton alloc]initWithText:buttonText isBig:NO] autorelease];
}

-(id)initWithText:(NSString *)buttonText isBig:(BOOL)big

{
	if((self== [super init]))
	   {
		   NSString *btnFrame = (big) ? @&#34;button_b.png&#34; : @&#34;button_s.png&#34;;
		   int fSize = 12;
		   [self setDisplayFrame:[[CCSpriteFrameCache sharedSpriteFrameCache]
								  spriteFrameByName:btnFrame]];
		   CCLabelTTF *label =[CCLabelTTF labelWithString:buttonText fontName:@&#34;Arial&#34;
												 fontSize:fSize +big * fSize];
		   label.position = ccp(self.contentSize.width/2, self.contentSize.height/2);
		   [self addChild:label z:1];
		   CCLabelTTF *labelShadow = [CCLabelTTF labelWithString:buttonTextfontName:@&#34;Arial&#34; fontSize:fSize + big *fSize];
		   labelShadow.position = ccp(self.contentSize.width/2 - (2 + big *2),self.contentSize.height/2);
		   labelShadow.color = ccBLACK;
		   labelShadow.opacity = 150;
		   [self addChild:labelShadow];
		   NSLog(@&#34;I&#039;m in&#34;);
		}
	   return self;
}

@end</code></pre>
<p>I already checked in the target folder if the button.s and button.b are there and they are.</p>
<p>I really don't know where to look now. You have an idea? Maybe it's the xcode version I have, 3.2.6?<br />
The tutorial I'm following is version 4, does it make a big difference?  I can't have version 4 because my mac is 10.6.8 snow leopard.
</p></description>
		</item>
		<item>
			<title>PiikeaMatt on "[GAME] Memory Train"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/27785#post-136500</link>
			<pubDate>Wed, 21 Dec 2011 22:30:21 +0000</pubDate>
			<dc:creator>PiikeaMatt</dc:creator>
			<guid isPermaLink="false">136500@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi everyone.   We released our first cocos2d based game recently.   Memory Train is a game of focus and concentration for kiddos ages 2-7.</p>
<p>App store:  <a href="http://piikea.st/cc2dmt" rel="nofollow">http://piikea.st/cc2dmt</a></p>
<p><a href="http://www.youtube.com/watch?v=4UnqePyae2c" rel="nofollow">http://www.youtube.com/watch?v=4UnqePyae2c</a></p>
<p>some cocos2d dev notes:  One of the big challenges with the game was loading many large (iPad resolution) highly detailed textures for sprite animations without running out of memory or having any loading screens or causing major hiccups during high frame-rate gameplay.  Also I went through several versions of  parallax code which was a great learning experience.  Overall, really happy to have used cocos2d on this project, and look forward to using it in future projects as well.</p>
<p>Thanks<br />
- Matt
</p></description>
		</item>
		<item>
			<title>dgtheman on "How to techinically &quot;scale&quot; a sprite without effecting image quality?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/25427#post-132375</link>
			<pubDate>Fri, 09 Dec 2011 02:16:48 +0000</pubDate>
			<dc:creator>dgtheman</dc:creator>
			<guid isPermaLink="false">132375@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>How can I scale a sprite to four times its original size without effecting the quality of the image? Is there something that can set the resolution of a sprite rather than the scale in cocos2d? The scale of the sprite I have noticed only magnifies the sprite thus leading to a bad image quality. I want to multiply the regular image by a scale of four without setting the "scale" so instead of sprite.scale = 4 I would like to make something like sprite.resolution = ..... so it actually "scales" the sprite not magnifies it.</p>
<p>Ok here is why im trying to do this:<br />
Originally all the images are exported in a pretty high resolution. Then in texture packer (the plist creator I use) I scale the images by 0.25. This way I can fit more into one plist. I need this scale in order to fit all the things I need in one plist (even the things I need in one scene). Please if anyone can help me with this dilemma I will be forever grateful for them. The plist issue has been troubling me since I started developing my game! I will be much obliged for any help!! THANK YOU!!! :)
</p></description>
		</item>
		<item>
			<title>TwistAndTrout on "Memory Card Game - stuck with the logic"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/24759#post-130539</link>
			<pubDate>Thu, 01 Dec 2011 13:21:52 +0000</pubDate>
			<dc:creator>TwistAndTrout</dc:creator>
			<guid isPermaLink="false">130539@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hy, I'm a newby....and I try to make a memory game. But after quite a few versions... I'm still stuck.<br />
I can't find the beginning and the logic to apply.</p>
<p>- How can I pick randomly 6 pairs of cards in a bunch of 24 cards?</p>
<p>I have of course some other problems..... but it will be a great help!!!
</p></description>
		</item>
		<item>
			<title>hodgey87 on "Building a simple app, similar to talking tom."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/13942#post-78602</link>
			<pubDate>Fri, 25 Feb 2011 21:42:36 +0000</pubDate>
			<dc:creator>hodgey87</dc:creator>
			<guid isPermaLink="false">78602@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hey guys, </p>
<p>Just a quick one, does anyone know how this sort of app was built? I've drew my own images, so I have plenty of them frame by frame. Would it just be run a certain sequence of animations depending on where the user touches the screen?</p>
<p>Cheers</p>
<p>Lee
</p></description>
		</item>
		<item>
			<title>ltby_sky on "Taken 40M memory for loading 2 piece of 2048*2048 pngs ?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/23887#post-128946</link>
			<pubDate>Sun, 27 Nov 2011 02:45:05 +0000</pubDate>
			<dc:creator>ltby_sky</dc:creator>
			<guid isPermaLink="false">128946@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I combine lot of magic effect frames into 2 big images (2048*2048), and taken more than 40M memory for loading them into memory by using CCSpriteFrameCache, anyone have this problem ?</p>
<p>Or you can just simply try with it:</p>
<p> [[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile: @"magicAtlas1.plist"];<br />
 [[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile: @"magicAtlas2.plist"];</p>
<p>magicAtlas1.plist:<br />
<a href="http://www.mediafire.com/?q5haj6zcy4aljnf" rel="nofollow">http://www.mediafire.com/?q5haj6zcy4aljnf</a><br />
magicAtlas1.png:<br />
<a href="http://www.mediafire.com/i/?d3al4ik74cx12mg" rel="nofollow">http://www.mediafire.com/i/?d3al4ik74cx12mg</a></p>
<p>magicAtlas2.plist:<br />
<a href="http://www.mediafire.com/?kho4jtdyuxixpt6" rel="nofollow">http://www.mediafire.com/?kho4jtdyuxixpt6</a><br />
magicAtlas2.png:<br />
<a href="http://www.mediafire.com/i/?9rrr67ewts4u5yn" rel="nofollow">http://www.mediafire.com/i/?9rrr67ewts4u5yn</a>
</p></description>
		</item>
		<item>
			<title>gomoliako on "Montessori Memory"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/23796#post-128617</link>
			<pubDate>Fri, 25 Nov 2011 00:03:40 +0000</pubDate>
			<dc:creator>gomoliako</dc:creator>
			<guid isPermaLink="false">128617@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi everyone,</p>
<p>I'm happy to announce Montessori Memory, an Educational game made by Mocha Code a brand new Inde Dev project based in Switzerland.</p>
<p>We created an <a href="http://mochacode.ch/post/13260783954/montessori-memory-our-new-educational-game">announce</a> post in our website,</p>
<p>Basically the game is a memory game, with 2 different modes, a classic mode where kids can play without problems and a learning mode, where kids can play learning the name of the objects.</p>
<p>This is our first game as educational game but we've planned to create more and more, so, give us a feedback and we'll try to improve our games ;)
</p></description>
		</item>
		<item>
			<title>love2script12 on "Want to clarify memory crashes - please help"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/22627#post-125538</link>
			<pubDate>Fri, 11 Nov 2011 13:40:53 +0000</pubDate>
			<dc:creator>love2script12</dc:creator>
			<guid isPermaLink="false">125538@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>My game sprites take up memory when they are created, and seem to keep hold of that memory. They do not take up additional memory if I allocate them again.<br />
My problem is that I get memory warnings in the first level itself, and from my understanding, the game needs at least that much memory to work.</p>
<p>I wanted to know if my sprite sheets have to be a particular size, or whether i don't release the sprites properly(they can be simple images in sprites also).</p>
<p>Right now I do this :<br />
[&#60;parent&#62; removeChild:&#60;child&#62; cleanup:YES];</p>
<p>I also do this:<br />
[&#60;child&#62; release];<br />
&#60;child&#62; = nil;</p>
<p>The deallocate methods are called for sure (even checked by tracing it in dealloc of CCSprite).<br />
Any comments are appreciated. Anything can be useful. Thanks! :/
</p></description>
		</item>
		<item>
			<title>xemus on "Adding UIGestureRecognizer support in cocos2d"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/8929#post-51655</link>
			<pubDate>Sun, 22 Aug 2010 20:19:31 +0000</pubDate>
			<dc:creator>xemus</dc:creator>
			<guid isPermaLink="false">51655@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I wanted to share some code I've written to allow using UIGestureRecognizer classes with cocos2d.  This code has saved me a tremendous amount of time handling touch events, so hopefully it will help some others out I can get some feedback on them in the process.  The main goal  was to be able to get the gesture recognizers to act as close to original design as possible without a lot of setup work to use them.</p>
<p>This major design change I did to accomplish this was to move touches from CCLayer based to CCNode based, this way can be seen as each node being a view.   Handling touches this way gives you a lot of flexibility and control to test for touches on individual objects of a scene or a layer like a sprite instead of just knowing the layer was touched somewhere.  This change was only for gesture recognizers, I left the way cocos handles individual touch events intact.  My other goal was the gesture recognizers should handle touches across nodes,  but a touch on a particular node can only be handled by itself and it's children, this mimics the way gesture recognizers normally work with subviews.</p>
<p>Note:<br />
Not all code changes are in this post, I made some changes to CCNode such as moving the isTouchEnabled from CCLayer and the code to retain its gesture recognizers and handle the actual attachment to the view.  If this post generates enough interest I will post a full patch.</p>
<p>Example initialization:<br />
<pre><code>CCGestureRecognizer* recognizer = [CCGestureRecognizer CCRecognizerWithRecognizerTargetAction:[[[UIRotationGestureRecognizer alloc]init] autorelease] target:self action:@selector(rotate:node:)];</code></pre>
<p>Example usage:<br />
Usage is very straightforward, the callback function that occurs once a gesture is recognized just needs to take a  UIGestureRecognizer and a CCNode as a parameter.  Normally you can tell what view was touched from the gesture recognizer, but since we only have one view the CCNode that was touched gets passed to the callback function as well.<br />
<pre><code>- (void) rotate:(UIGestureRecognizer*)recognizer node:(CCNode*)node
{
  UIRotationGestureRecognizer* rotate = (UIRotationGestureRecognizer*)recognizer;
  float r = node.rotation;
  node.rotation += CC_RADIANS_TO_DEGREES(rotate.rotation) -r;
}</code></pre>
<p>Here is the source:<br />
CCGestureRecognizer.h<br />
<pre><code>#ifndef __CCGestureRecognizer_H__
#<a href='http://www.cocos2d-iphone.org/forum/tags/define'>define</a> __CCGestureRecognizer_H__

#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#34;ccTypes.h&#34;
#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#34;CCNode.h&#34;
#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#60;UIKit/UIKit.h&#62;

@class CCNode;

@interface CCGestureRecognizer : NSObject &#60;UIGestureRecognizerDelegate&#62;
{
  UIGestureRecognizer* m_gestureRecognizer;
  CCNode* m_node;

  id&#60;UIGestureRecognizerDelegate&#62; m_delegate;

  id m_target;
  SEL m_callback;
}

@property(nonatomic,readonly) UIGestureRecognizer* gestureRecognizer;
@property(nonatomic,assign) CCNode* node;
@property(nonatomic,assign) id&#60;UIGestureRecognizerDelegate&#62; delegate;
@property(nonatomic,assign) id target;
@property(nonatomic,assign) SEL callback;

- (id) initWithRecognizerTargetAction:(UIGestureRecognizer*)gestureRecognizer target:(id)target action:(SEL)action;
+ (id) CCRecognizerWithRecognizerTargetAction:(UIGestureRecognizer*)gestureRecognizer target:(id)target action:(SEL)action;

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch;
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer;
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer;

// this is the function the gesture recognizer will callback and we will add our CCNode onto it
- (void) callback:(UIGestureRecognizer*)recognizer;
@end

#endif  // end of __CCGestureRecognizer_H__</code></pre>
<p>CCGestureRecognizer.m<br />
It looks m_node isn't retained or released, but when you attach a gesture recognizer to a CCNode the node sets this value and also unsets this value when it is released.   Since CCNode keeps track of gesture recognizers attached to it doing a retain would mean both objects would never get released.<br />
<pre><code>#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#34;CCGestureRecognizer.h&#34;
#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#34;CCDirector.h&#34;
#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#34;ccMacros.h&#34;
#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#34;CGPointExtension.h&#34;

@implementation CCGestureRecognizer

-(void)dealloc
{
  [m_delegate release];
  [super dealloc];
}

- (UIGestureRecognizer*)gestureRecognizer
{
  return m_gestureRecognizer;
}

- (CCNode*)node
{
  return m_node;
}

- (void)setNode:(CCNode*)node
{
  // we can&#39;t retain the node, otherwise a node will never get destroyed since it contains a
  // ref to this.  if node gets unrefed it will destroy this so all should be good
  m_node = node;
}

- (id&#60;UIGestureRecognizerDelegate&#62;)delegate
{
  return m_delegate;
}

- (void) setDelegate:(id&#60;UIGestureRecognizerDelegate&#62;)delegate
{
  [m_delegate release];
  m_delegate = delegate;
  [m_delegate retain];
}

- (id)target
{
  return m_target;
}

- (void)setTarget:(id)target
{
  [m_target release];
  m_target = target;
  [m_target retain];
}

- (SEL)callback
{
  return m_callback;
}

- (void)setCallback:(SEL)callback
{
  m_callback = callback;
}

- (id)initWithRecognizerTargetAction:(UIGestureRecognizer*)gestureRecognizer target:(id)target action:(SEL)action
{
  if( (self=[super init]) )
  {
    m_gestureRecognizer = gestureRecognizer;
    [m_gestureRecognizer retain];
    [m_gestureRecognizer addTarget:self action:@selector(callback:)];

    // setup our new delegate
    m_delegate = m_gestureRecognizer.delegate;
    m_gestureRecognizer.delegate = self;

    m_target = target;
    [m_target retain];
    m_callback = action;
  }
  return self;
}

+ (id)CCRecognizerWithRecognizerTargetAction:(UIGestureRecognizer*)gestureRecognizer target:(id)target action:(SEL)action
{
  [[[self alloc] initWithRecognizerTargetAction:gestureRecognizer target:target action:action] autorelease];
}

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
{
  CGPoint pt = [[CCDirector sharedDirector] convertToGL:[touch locationInView: [touch view]]];

  BOOL rslt = [m_node isPointInArea:pt];

  if( rslt )
  {
    // still ok, now check children of parents after this node
    CCNode* node = m_node;
    CCNode* parent = m_node.parent;
    while( node != nil &#38;&#38; rslt)
    {
      CCNode* child;
      BOOL nodeFound = NO;
      CCARRAY_FOREACH(parent.children, child)
      {
        if( !nodeFound )
        {
          if( !nodeFound &#38;&#38; node == child )
            nodeFound = YES;  // we need to keep track of until we hit our node, any past it have a higher z value
          continue;
        }

        if( [child isNodeInTreeTouched:pt] )
        {
          rslt = NO;
          break;
        }
      }

      node = parent;
      parent = node.parent;
    }
  }

  if( rslt &#38;&#38; m_delegate )
    rslt = [m_delegate gestureRecognizer:gestureRecognizer shouldReceiveTouch:touch];

  return rslt;
}

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{
  if( !m_delegate )
    return YES;
  return [m_delegate gestureRecognizer:gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:otherGestureRecognizer];
}

- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
{
  if( !m_delegate )
    return YES;
  return [m_delegate gestureRecognizerShouldBegin:gestureRecognizer];
}

- (void)callback:(UIGestureRecognizer*)recognizer
{
  if( m_target )
    [m_target performSelector:m_callback withObject:recognizer withObject:m_node];
}
@end</code></pre>
<p>Here are some of the changes to CCNode<br />
<pre><code>-(BOOL) isPointInArea:(CGPoint)pt
{
  if( !visible_ )
    return NO;

  /*  convert the point to the nodes local coordinate system to make it
   easier to compare against the area the node occupies*/
  pt = [self convertToNodeSpace:pt];

  // we have to take the anchor point into account for checking
  CGRect rect;
  /*  we should be able to use touchableArea here, even if a node doesn&#39;t set
   this, it will return the contentArea.  */
  rect.size = self.touchableArea;
  CGPoint anchor = anchorPoint_;

  // we pretty much need to undo the anchor to get our rect to start at the lower left
  anchor.x = 0.5f - anchor.x;
  anchor.y = 0.5f - anchor.y;

  rect.origin = CGPointMake( -(rect.size.width*anchor.x), -(rect.size.height*anchor.y) );

  if( CGRectContainsPoint(rect,pt) )
    return YES;
  return NO;
}

-(BOOL) isNodeInTreeTouched:(CGPoint)pt
{
  if( [self isPointInArea:pt] )
    return YES;

  BOOL rslt = NO;
  CCNode* child;
  CCARRAY_FOREACH(children_, child )
  {
    if( [child isNodeInTreeTouched:pt] )
    {
      rslt = YES;
      break;
    }
  }
  return rslt;
}

-(CGSize) touchableArea
{
  // we use content size if touchable area is 0
  if( touchableArea_.width != 0.0f &#38;&#38;
      touchableArea_.height != 0.0f )
    return touchableArea_;
  else
    return contentSize_;
}

-(void) setTouchableArea:(CGSize)area
{
	touchableArea_ = area;
}</code></pre></description>
		</item>
		<item>
			<title>dgtheman on "Do too many updates take up too much memory?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/22659#post-125685</link>
			<pubDate>Sat, 12 Nov 2011 07:12:43 +0000</pubDate>
			<dc:creator>dgtheman</dc:creator>
			<guid isPermaLink="false">125685@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I have a lot of updates running at once in my app. These updates are categorized for the important sprites in my game, so the Ais are running their own update, a cabinet which generates random loot and is opened when tapped is going through its own update, etc. Does this take up too much memory? Because on a 2g ipod the app gives a memory warning level = 2 when in the main city (with the most sprites in the scene at once) and gives a memory warning level = 1 when the updates for some major sprites are remove. Pretty much Im trying to ask if it is worth it to almost destroy my way of organization and only update in one scene...so run only one update and pass in every sprite's data in that one update. This would take a very long time and I would have to restructure a lot of well organized code. Thats why I really want to know if it is worth doing so. I want to make this app playable on the ipod 2g with no memory issues and if I need to do this then I will. Also, here is some more background info that is contributing to the memory issues. I would like to know if I can resolve these issues instead of the update issue which does not fix the whole thing anyway...</p>
<p>1.)I have 11 plists loaded in at once (each 1024 x 1024) and I will need some frames from each of them in the scene at one time. Should I organize it so that I use less? If so how many should be in the scene at once?</p>
<p>2.)I have a lot of arrays initalized at the beginning of the game. Should I restructure my code to get rid of all these arrays? The arrays contain CCSprites and b2Bodys (pointers)</p>
<p>3.) I have a NSDictionary thats stores a lot of NSNumbers. I had posted another question regarding whether or not these take up too much memory and almost evreyone said that unless you are storing 1 million of them it will ot matter. I am only storing maybe 200.</p>
<p>4.)I have some global variables that need to be retained (including arrays and ccsprites) should I somehow get rid of these global variables? I know its not good practice to use them but I did not know this when I first started programming my game....Also, if possible this option should be ruled out because I need the GameScene layer and the hero sprite as global variables no matter what...</p>
<p>Thanks for any suggestions!!
</p></description>
		</item>
		<item>
			<title>gaminghorror on "Memory usage of CCTexture2D is doubled during load"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/4526#post-26900</link>
			<pubDate>Tue, 16 Feb 2010 19:44:47 +0000</pubDate>
			<dc:creator>gaminghorror</dc:creator>
			<guid isPermaLink="false">26900@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I noticed that loading a Texture consumes twice the memory it should but only while the texture is being loaded. I think i once read about it here but i'm not sure, which is why i'm posting this. It could also be a bug because i'm using 32-bit PNG in RGBA8888 format. I stepped through CCTexture2D and there is certainly no conversion being done.</p>
<p>When i load my texture atlases i ran into memory warnings. I have &#62;20 MBs free in all cases, and am loading at most 14 MB of textures. Yet i got memory warnings. So i dove in to figure out what is going on.</p>
<p>I found out that each 1024x1024x32 PNG image takes twice the amount (8 MB) of memory but only while loading (in the same tick/step/frame), which is why i can't load my texture atlases all at once. After refactoring the texture loading into a scheduled method that runs at 0.1f interval i get the following output and no more memory warnings. Notice how each texture takes 8 MB during load, but when the next one is being loaded 4 MB have re-appeared.</p>
<pre><code>Loading: Atlas_Tierteile1
 start KB = 27516.000000	final KB = 18972.000000	diff = 8544.000000
Loading: Atlas_Tierteile2
 start KB = 23144.000000	final KB = 15840.000000	diff = 7304.000000
Loading: Atlas_Tierteile3
 start KB = 19960.000000	final KB = 12196.000000	diff = 7764.000000
Loading: Atlas_Tierteile4
 start KB = 16632.000000	final KB = 15660.000000	diff = 972.000000
 start KB = 16180.000000	final KB = 16180.000000	diff = 0.000000</code></pre>
<p>`</p>
<p>I wonder, did anyone else run into this problem and how did you solve it? I'm currently thinking about writing a scheduled texture loader that loads them in sequence. But maybe it's also possible to force freeing the memory within the same step, possibly by draining the autorelease pool somehow?</p>
<p>I also came across "async" methods, can i use those or are they simply for thread-safe texture loading?
</p></description>
		</item>
		<item>
			<title>gametreesnet on "pointer question"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/22446#post-124581</link>
			<pubDate>Sat, 05 Nov 2011 06:41:24 +0000</pubDate>
			<dc:creator>gametreesnet</dc:creator>
			<guid isPermaLink="false">124581@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hello guys!<br />
I'm here to ask some questions about pointer.<br />
I typically see these statements:</p>
<p>CCSprite *aaa;</p>
<p>CGSize bbb;</p>
<p>The problem is that I don't know why is there a pointer in CCSprite and not in CGSize<br />
Also, does it matter if the pointer is after CCSprite like CCSprite*?<br />
Thanks!
</p></description>
		</item>
		<item>
			<title>dimitriosb on "Play streaming sound with CocosDenshion"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/22370#post-124176</link>
			<pubDate>Wed, 02 Nov 2011 11:24:03 +0000</pubDate>
			<dc:creator>dimitriosb</dc:creator>
			<guid isPermaLink="false">124176@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hello,<div><br /></div><div>I want to play a music file without loading all of it in memory, as it currently takes up 30 MB when loaded. I want to use streaming, so that the buffer does not load the whole file. Is that possible with CocosDenshion?</div><div><br /></div><div>I only found this post&#160;<a href="http://www.cocos2d-iphone.org/forum/topic/13638">http://www.cocos2d-iphone.org/forum/topic/13638</a>&#160;but I understand that the reply refers only to dynamically generated audio.</div><div><br /></div><div>Thank you,</div><div>Dimitrios</div>
</p></description>
		</item>
		<item>
			<title>djciego on "Problem with crash in iPod"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/22122#post-122918</link>
			<pubDate>Tue, 25 Oct 2011 13:40:01 +0000</pubDate>
			<dc:creator>djciego</dc:creator>
			<guid isPermaLink="false">122918@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi,</p>
<p>I'm developing a simple game which uses really few textures and sprites. The app is working fine on iPad and iPhone, but on iPod 4 it crashes from time to time. I've searched a bit, and come to <a href="http://www.cocos2d-iphone.org/forum/topic/15722" rel="nofollow">http://www.cocos2d-iphone.org/forum/topic/15722</a>, but I still don't understand what is happening. If I use Instruments to check the memory, it is always running at 5-6 Mb, except when it loads all the textures for a stage; then it raises for a moment up to 25-30 Mb, and falls again to 5-6 Mb.<br />
Well, if the iPod has a RAM of 256 Mb, I don't understand what is happening, because I'm far enough from that limit. What is worst, is that I don't receive any message, any memory warning when it happens. Simply the app disappears and the iPod goes to the main board. I don't have any clue to solve this thing. I've been optimizing every texture, check every allocation and don't know what else can I do.<br />
Has anyone faced this problem? With Instruments the only thing I've found is some leaks from OpenAL and from AdMob SDK, but are only a few bytes and I can't do anything with it.</p>
<p>Any help will be appreciated, thanks.
</p></description>
		</item>
		<item>
			<title>SoundBlaster on "&#039;ReplaceScene&#039; and memory management"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/22065#post-122615</link>
			<pubDate>Sun, 23 Oct 2011 09:31:14 +0000</pubDate>
			<dc:creator>SoundBlaster</dc:creator>
			<guid isPermaLink="false">122615@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hello!<br />
I create the interactive book for iPad.<br />
To turn the pages I use:<br />
<code>[[CCDirector sharedDirector] replaceScene:[pageClass scene]];</code><br />
I don't have any leaks, but I have notice the memory problem.<br />
For example, in my test project  I have 3 pages: first page has 1 picture (1024*768), scene of second picture if free of any child, and third page is also free.<br />
When CCDirector places first scene, allocated memory is around 11 MB.<br />
When first scene is replaced by second scene, there is also 11MB.<br />
And when second scene is replaced by third scene memory go to 8 MB, that is normal for my page without child.<br />
All methods like <code>dealloc</code> <code>onEnter</code> <code>onExit</code> are called properly.</p>
<p>In my real project every page needs around 20-30 MB of memory (I use big atlases). Simultaneous storage of 3 pages in memory calls memory warnings and causes crashing my app, because my iPad 1 doesn't have enough free memory.</p>
<p>Is it bug of Cocos?<br />
May be I do somethings wrong? Where I can read about runloop of cocos2d scene?
</p></description>
		</item>
		<item>
			<title>zardon on "What is the correct way to handle scenes?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/18566#post-104131</link>
			<pubDate>Mon, 11 Jul 2011 14:35:30 +0000</pubDate>
			<dc:creator>zardon</dc:creator>
			<guid isPermaLink="false">104131@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I read in the documentation that one should not constantly pushScene onto the stack, but there isn't anything in the documentation on what the correct way to resolve this problem is.</p>
<p>Can someone clarify what the best way to handle scenes without pushing loads of scenes onto the stack and into memory?</p>
<p>Thanks
</p></description>
		</item>
		<item>
			<title>R40ul on "CCTransitionPageTurn and dealloc"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/21957#post-122038</link>
			<pubDate>Wed, 19 Oct 2011 13:12:08 +0000</pubDate>
			<dc:creator>R40ul</dc:creator>
			<guid isPermaLink="false">122038@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hello,<br />
I'm currently creating a cocos2d book where my main class is an IBPage.<br />
I switch between 2 IBPage using the CCTransitionPageTurn transition. When I use the book properly, everything works : the new page appears, and as soon as the CCTransitionPageTurn is finished, the previous page dealloc gets called.<br />
Thus, if I swipe really quickly between the pages, I noticed that sometimes, the dealloc of the previous page might not be called, and I can have up to 5 pages that has not been deallocated, which leads to a memory crash.<br />
I could set up a timer, which will block the user interaction during x seconds as a new page is displayed, and with a delay long enough, I can be sure that the previous page is released. Thus, I'd like to know if there is a more clever way to do this.<br />
I've already tried to increment a static variable in my init method, and to decrease it in my dealloc, in order to block the menu when this variable is &#62; 1, but, for some reason, it sometimes stay stuck at 2.</p>
<p>Could you please tell me how to make sure that every page is released.<br />
Thanks.
</p></description>
		</item>
		<item>
			<title>axwack on "Deleting sprite but when touched again shows up"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/21645#post-120297</link>
			<pubDate>Sun, 09 Oct 2011 13:32:36 +0000</pubDate>
			<dc:creator>axwack</dc:creator>
			<guid isPermaLink="false">120297@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I have some code that has objects floating around. When the child touches it, the object turns to a bird. I use a Fade out action on the original sprite. The funny thing is, is that when I touch the same location, the bird shows up again. I figured it was because I was not deleting the original object but it's not the case. Here is the code. What am I doing wrong?</p>
<pre><code>for (CCSprite* sprite in spritesArray)
    {

        if (CGRectContainsPoint(sprite.boundingBox, location))
        {
            NSLog(@&#34;Found sprite @ %f, %f with tag: %d&#34;, sprite.position.x, sprite.position.y, sprite.tag);

            [sprite stopAllActions];
            [sprite runAction: [CCSequence actions:fadeOut, [CCCallFuncN actionWithTarget:self selector:@selector(deleteSprite:)]
            ,nil]];

            if (sprite.tag==1)
            {
                CCSprite *copyBT = Bird_Tweet;
                copyBT.position= ccp(sprite.position.x, sprite.position.y);
                [self addChild:copyBT ];
                [copyBT stopAllActions];
                [[SimpleAudioEngine sharedEngine] playEffect:@&#34;tweet.mp3&#34;];
                [copyBT runAction: [CCSequence actions:fadeIn,fadeOut,[CCCallFuncN actionWithTarget:self selector:@selector(deleteSprite:)], nil]];
                [copyBT release];
                [Bird_Tweet retain];
            }</code></pre>
<p>This is just a snippet of a first test. </p>
<p>sometimes when I click in the whitespace, the system wants to add one of the birds. I'm not sure why this would be case. It seems that the location is cached somewhere. Anyone with thoughts?
</p></description>
		</item>
		<item>
			<title>love2script12 on "Memory issues - where to deallocate?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/21310#post-118528</link>
			<pubDate>Wed, 28 Sep 2011 04:08:27 +0000</pubDate>
			<dc:creator>love2script12</dc:creator>
			<guid isPermaLink="false">118528@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>My game runs fine when I run the first scene.  I use something called 'getAvailableMegaBytes' to trace the memory available on the device.<br />
So when I play the second level which uses the same scene all over again, the available memory reduces and the game is ultimately going to give memory warnings or crash when it runs out of memory.</p>
<p>Any pointers on what I should do to deallocate properly? Could there be any other reason for this to happen?</p>
<p>Thanks
</p></description>
		</item>
		<item>
			<title>jarrydios on "Memory usage with Textures"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/21403#post-119004</link>
			<pubDate>Fri, 30 Sep 2011 19:04:27 +0000</pubDate>
			<dc:creator>jarrydios</dc:creator>
			<guid isPermaLink="false">119004@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I have a bunch of textures and when loading them into memory there is a huge spike of 20MB. I had this same issue a while back and converted all the atlases to pvr.ccz</p>
<p>The problem is it spikes the exact memory usage and I have no idea why. </p>
<p>On a retina display device, do the normal and the -hd texutres get loaded into memory or what could be causing the 20mb memory usage? The textures are only a total of 11.8mb for HD textures only.</p>
<p>So this seems to be adding them twice into memory. </p>
<p>I thought the issue was resolved in the newest cocos2d and loading in pvr.ccz wouldnt realloc the memory and cause a double usage.</p>
<p>Please. this is a serious issue and I would greatly appreciate any help.</p>
<p>Is there a way to load them one at a time to avoid a spike or how does it work internally? </p>
<p>Whenever I access the spritecache will there be a spike of 20mb?</p>
<p>Thanks
</p></description>
		</item>
		<item>
			<title>blazezh on "Memory Warning for allocation is always lower than 10.0MB"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/21355#post-118742</link>
			<pubDate>Thu, 29 Sep 2011 04:43:59 +0000</pubDate>
			<dc:creator>blazezh</dc:creator>
			<guid isPermaLink="false">118742@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hello everyone,<br />
       My first game using cocos2d is nearly finished, but I'm suffering from the memory warning. I've tried a lot of ways to reduce it.<br />
      I've tried to use the allocation instrument to monitor the memory allocate, I found out that my game uses no more than 5 MB while in game. Several blocks of allocation 4.0MB appears while loading. It should be the sprite frame cache loading for a 1024*1024 png file. So the total allocation is no more than 10.0MB.<br />
      But I still receive memory warning level = 2 while testing the game. It's very strange I can't see any "memory warning flag" while using instruments to observe. I'm pretty sure I don't have any serious leak in the game.</p>
<p>      DOES ANYONE have any idea about this stuff? <strong>Anything</strong> would be helpful since I'm working on IOS the first time. Thanks a lot!
</p></description>
		</item>

	</channel>
</rss>

