Note that there are some explanatory texts on larger screens.

plurals
  1. POUnexplainable 16MB malloc in cocos2d app?
    primarykey
    data
    text
    <p>I am developing a cocos2d based app and I am now testing it against the Allocations Tool to check whether some leakage is present. I have noticed there are instants at which a malloc of 16 MB occurs and I can actually not say why. I guess it is something related to the cocos framework but I am not sure of it. </p> <p>Have you ever experienced the same behaviour? Sometimes the app crashes because of this during the tests. </p> <p>Thank you in advance</p> <p>Andrea </p> <p>Some Futher Details</p> <p>It seems the problem is related to the way cocos caches sprites. I am using zwoptex texture atlas. Here is the call stack</p> <pre><code>+[CCSpriteSheet spriteSheetWithFile:capacity:] CCSpriteSheet.m:69 -[CCSpriteSheet initWithFile:capacity:] CCSpriteSheet.m:104 -[CCTextureCache addImage:] CCTextureCache.m:243 -[CCTexture2D(Image) initWithImage:] CCTexture2D.m:207 -[CCTexture2D(Image) initPremultipliedATextureWithImage:pixelsWide:pixelsHigh:] </code></pre> <p>In that point of the execution I am actually loading the largest sprite I have. It is about 900KB. While the others are very little . Am I using cocos in the wrong way?. For example are there parameters aimed at reducing such peaks. However I would expect that once cached the image would not be loaded any time I need it. Instead I experience new spikes any time I do not use such sprite for some time. I then guessed the cache would not be cleared if I reteined the image but despite of the fact I retain it the malloc still occurs. </p> <p>I would also like to know why the application RAM footprint changes from 3MB to 80MB when running on the simulator instead of the device</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload