ios - Cocos2d 2.0: I get a higher memory allocation peak setting default pixel format to kCCTexture2DPixelFormat_RGBA4444 -


i getting kind of crazy. got appdelegate lunch introduction scene. used texturepacker plist , png file using rgba4444 pixel format , set in xcode "no" option "compress png files" in order preserve optimized files.

my appdelegate configured default pixel format of keaglcolorformatrgb565:

 ccglview *glview = [ccglview viewwithframe:[window_ bounds]                                pixelformat:keaglcolorformatrgb565   //keaglcolorformatrgba8                                depthformat:0    //gl_depth_component24_oes                         preservebackbuffer:no                                 sharegroup:nil                              multisampling:no                            numberofsamples:0]; 

scenario 1: run appdelegate , push introduction scene without changing default pixel format (in other words, leaving default appdelegate settings) , following allocation analysis. blue peak corresponds 16 mb memory allocation in introductionscene when creating first ccsprite frame plist file (the blue peak corresponds 16 mb, couldn't take better screenshot values displayed, rest corresponds 2mb of memory allocated - sorry).

first case

scenario 2: set default pixel format kcctexture2dpixelformat_rgba4444 in introbackgroundscene (as below).

@implementation introbackgroundscene  -(id) init {     if ((self = [super init]))     {         [cctexture2d setdefaultalphapixelformat:kcctexture2dpixelformat_rgba4444];          [[ccspriteframecache sharedspriteframecache] addspriteframeswithfile:@"intro background.plist"];         background = [ccsprite spritewithspriteframename:@"intro background 0.png"];         background.anchorpoint = cgpointmake(0.5f, 0.5f);         background.position = cgpointmake(160.0f, 0.0f);         [self addchild:background];          foreground = [ccsprite spritewithspriteframename:@"intro background 1.png"];         foreground.anchorpoint = cgpointmake(0.5f, 0.5f);         foreground.position = cgpointmake(160.0f, 0.0f);         [self addchild:foreground z:2]; 

this gives me peak of 26 mb of memory usage (even if pixel format settings set kcctexture2dpixelformat_rgba4444). see below (the blue peak corresponds 26 mb, couldn't take better screenshot values displayed - sorry):

second case

i thought have reduced memory allocation , not increased. why this?

secondly, why memory allocation peaks whatever number (16/26mb) , gets down 2mb? expecting 2mb using optimized texture sheets.

here texturepacker build settings:

texture packer

i building cocos2d , using 2048*2048 pixels sheet rgba4444 activated. should consume 2 bytes per pixel total of 8 mb. i don't understand why memort allocation peaks 16 mb in introbackground init method , why goes down 2mb (and not 8 mb).

any insight on how analyze , understand appreciated.

edit: texture dumb info ipod touch 4th gen:

cocos2d: "intro background.png" rc=7 id=3 2048 x 2048 @ 32 bpp => 16384 kb cocos2d: cctexturecache dumpdebuginfo: 2 textures, 16448 kb (16.06 mb)

it looks frames in texture sheet temporarily loaded in memory. normal? is there way avoid this? (this might cause memory leaks when loading scens multiple sheets)

my guess (to explain peak) app has 1) load zipped data stream in core, 2) unzip in core ... holding both zipped , unzipped plus ancillary objects used in process ... when memory block passed gpu, memory released (and texture's memory requirement discounted main process) ... assuming trace taken on device. simulator not make use of host's gpu, taking same trace on simulator show higher memory foot print, includes textures' memory requirements.


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -